From 4f8c88b13265cc1139412191d342209a3fe96f45 Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:08:23 +0000 Subject: [PATCH] [skip ci] Archive 8ef488983a2899b9a7fb05aaead498d26346287b --- .../Az.StorageCache.format.ps1xml | 1212 ++- .../Az.StorageCache.psd1 | 2 +- .../Properties/AssemblyInfo.cs | 12 +- .../Get-AzStorageCacheAmlFileSystem.ps1 | 3 + .../Get-AzStorageCacheAutoExportJob.ps1 | 252 + .../Get-AzStorageCacheAutoImportJob.ps1 | 252 + .../exports/Get-AzStorageCacheImportJob.ps1 | 252 + ...oke-AzStorageCacheAmlFileSystemArchive.ps1 | 3 + .../New-AzStorageCacheAmlFileSystem.ps1 | 53 +- .../New-AzStorageCacheAutoExportJob.ps1 | 322 + .../New-AzStorageCacheAutoImportJob.ps1 | 356 + .../exports/New-AzStorageCacheImportJob.ps1 | 346 + .../exports/ProxyCmdletDefinitions.ps1 | 4064 ++++++++- .../Remove-AzStorageCacheAmlFileSystem.ps1 | 3 + .../Remove-AzStorageCacheAutoExportJob.ps1 | 266 + .../Remove-AzStorageCacheAutoImportJob.ps1 | 266 + .../Remove-AzStorageCacheImportJob.ps1 | 266 + ...top-AzStorageCacheAmlFilesystemArchive.ps1 | 3 + .../Update-AzStorageCacheAmlFileSystem.ps1 | 39 +- .../Update-AzStorageCacheAutoExportJob.ps1 | 303 + .../Update-AzStorageCacheAutoImportJob.ps1 | 303 + .../Update-AzStorageCacheImportJob.ps1 | 302 + .../StorageCache.Autorest/generate-info.json | 2 +- .../api/Models/AmlFilesystem.PowerShell.cs | 56 + .../generated/api/Models/AmlFilesystem.cs | 156 +- .../AmlFilesystemHsmSettings.PowerShell.cs | 8 + .../api/Models/AmlFilesystemHsmSettings.cs | 46 +- .../Models/AmlFilesystemHsmSettings.json.cs | 10 + .../AmlFilesystemProperties.PowerShell.cs | 56 + .../api/Models/AmlFilesystemProperties.cs | 157 +- .../Models/AmlFilesystemProperties.json.cs | 2 + .../AmlFilesystemPropertiesHsm.PowerShell.cs | 8 + .../api/Models/AmlFilesystemPropertiesHsm.cs | 43 +- ...FilesystemRootSquashSettings.PowerShell.cs | 196 + ...esystemRootSquashSettings.TypeConverter.cs | 148 + .../Models/AmlFilesystemRootSquashSettings.cs | 151 + .../AmlFilesystemRootSquashSettings.json.cs | 119 + .../Models/AmlFilesystemUpdate.PowerShell.cs | 48 + .../api/Models/AmlFilesystemUpdate.cs | 107 + ...mlFilesystemUpdateProperties.PowerShell.cs | 48 + .../Models/AmlFilesystemUpdateProperties.cs | 114 + .../AmlFilesystemUpdateProperties.json.cs | 2 + .../generated/api/Models/Any.PowerShell.cs | 156 + .../generated/api/Models/Any.TypeConverter.cs | 146 + .../generated/api/Models/Any.cs | 34 + .../generated/api/Models/Any.json.cs | 104 + .../api/Models/AutoExportJob.PowerShell.cs | 422 + .../api/Models/AutoExportJob.TypeConverter.cs | 147 + .../generated/api/Models/AutoExportJob.cs | 618 ++ .../api/Models/AutoExportJob.json.cs | 112 + .../AutoExportJobProperties.PowerShell.cs | 308 + .../AutoExportJobProperties.TypeConverter.cs | 147 + .../api/Models/AutoExportJobProperties.cs | 484 ++ .../Models/AutoExportJobProperties.json.cs | 134 + ...utoExportJobPropertiesStatus.PowerShell.cs | 276 + ...ExportJobPropertiesStatus.TypeConverter.cs | 147 + .../Models/AutoExportJobPropertiesStatus.cs | 431 + .../AutoExportJobPropertiesStatus.json.cs | 178 + .../Models/AutoExportJobUpdate.PowerShell.cs | 180 + .../AutoExportJobUpdate.TypeConverter.cs | 147 + .../api/Models/AutoExportJobUpdate.cs | 93 + .../api/Models/AutoExportJobUpdate.json.cs | 110 + ...utoExportJobUpdateProperties.PowerShell.cs | 162 + ...ExportJobUpdateProperties.TypeConverter.cs | 147 + .../Models/AutoExportJobUpdateProperties.cs | 62 + .../AutoExportJobUpdateProperties.json.cs | 107 + .../AutoExportJobUpdateTags.PowerShell.cs | 160 + .../AutoExportJobUpdateTags.TypeConverter.cs | 147 + .../api/Models/AutoExportJobUpdateTags.cs | 35 + .../AutoExportJobUpdateTags.dictionary.cs | 75 + .../Models/AutoExportJobUpdateTags.json.cs | 109 + .../AutoExportJobsListResult.PowerShell.cs | 176 + .../AutoExportJobsListResult.TypeConverter.cs | 147 + .../api/Models/AutoExportJobsListResult.cs | 79 + .../Models/AutoExportJobsListResult.json.cs | 121 + ...pdateAcceptedResponseHeaders.PowerShell.cs | 167 + ...teAcceptedResponseHeaders.TypeConverter.cs | 151 + ...ExportJobsUpdateAcceptedResponseHeaders.cs | 60 + ...tJobsUpdateAcceptedResponseHeaders.json.cs | 107 + .../api/Models/AutoImportJob.PowerShell.cs | 326 + .../api/Models/AutoImportJob.TypeConverter.cs | 147 + .../generated/api/Models/AutoImportJob.cs | 372 + .../api/Models/AutoImportJob.json.cs | 112 + .../AutoImportJobProperties.PowerShell.cs | 212 + .../AutoImportJobProperties.TypeConverter.cs | 147 + .../api/Models/AutoImportJobProperties.cs | 243 + .../Models/AutoImportJobProperties.json.cs | 146 + ...utoImportJobPropertiesStatus.PowerShell.cs | 420 + ...ImportJobPropertiesStatus.TypeConverter.cs | 147 + .../Models/AutoImportJobPropertiesStatus.cs | 745 ++ .../AutoImportJobPropertiesStatus.json.cs | 206 + ...opertiesStatusBlobSyncEvents.PowerShell.cs | 265 + ...rtiesStatusBlobSyncEvents.TypeConverter.cs | 151 + ...ImportJobPropertiesStatusBlobSyncEvents.cs | 335 + ...tJobPropertiesStatusBlobSyncEvents.json.cs | 173 + .../Models/AutoImportJobUpdate.PowerShell.cs | 180 + .../AutoImportJobUpdate.TypeConverter.cs | 147 + .../api/Models/AutoImportJobUpdate.cs | 93 + .../api/Models/AutoImportJobUpdate.json.cs | 110 + ...utoImportJobUpdateProperties.PowerShell.cs | 162 + ...ImportJobUpdateProperties.TypeConverter.cs | 147 + .../Models/AutoImportJobUpdateProperties.cs | 62 + .../AutoImportJobUpdateProperties.json.cs | 107 + .../AutoImportJobUpdateTags.PowerShell.cs | 160 + .../AutoImportJobUpdateTags.TypeConverter.cs | 147 + .../api/Models/AutoImportJobUpdateTags.cs | 35 + .../AutoImportJobUpdateTags.dictionary.cs | 75 + .../Models/AutoImportJobUpdateTags.json.cs | 109 + .../AutoImportJobsListResult.PowerShell.cs | 176 + .../AutoImportJobsListResult.TypeConverter.cs | 147 + .../api/Models/AutoImportJobsListResult.cs | 79 + .../Models/AutoImportJobsListResult.json.cs | 121 + ...pdateAcceptedResponseHeaders.PowerShell.cs | 167 + ...teAcceptedResponseHeaders.TypeConverter.cs | 151 + ...ImportJobsUpdateAcceptedResponseHeaders.cs | 60 + ...tJobsUpdateAcceptedResponseHeaders.json.cs | 107 + .../Models/ErrorAdditionalInfo.PowerShell.cs | 172 + .../ErrorAdditionalInfo.TypeConverter.cs | 147 + .../api/Models/ErrorAdditionalInfo.cs | 80 + .../api/Models/ErrorAdditionalInfo.json.cs | 116 + .../api/Models/ErrorDetail.PowerShell.cs | 196 + .../api/Models/ErrorDetail.TypeConverter.cs | 147 + .../generated/api/Models/ErrorDetail.cs | 149 + .../generated/api/Models/ErrorDetail.json.cs | 147 + .../api/Models/ErrorResponse.PowerShell.cs | 208 + .../api/Models/ErrorResponse.TypeConverter.cs | 147 + .../generated/api/Models/ErrorResponse.cs | 151 + .../api/Models/ErrorResponse.json.cs | 111 + .../api/Models/ImportJob.PowerShell.cs | 446 + .../api/Models/ImportJob.TypeConverter.cs | 146 + .../generated/api/Models/ImportJob.cs | 671 ++ .../generated/api/Models/ImportJob.json.cs | 112 + .../Models/ImportJobProperties.PowerShell.cs | 332 + .../ImportJobProperties.TypeConverter.cs | 147 + .../api/Models/ImportJobProperties.cs | 543 ++ .../api/Models/ImportJobProperties.json.cs | 144 + .../ImportJobPropertiesStatus.PowerShell.cs | 284 + ...ImportJobPropertiesStatus.TypeConverter.cs | 147 + .../api/Models/ImportJobPropertiesStatus.cs | 425 + .../Models/ImportJobPropertiesStatus.json.cs | 186 + .../api/Models/ImportJobUpdate.PowerShell.cs | 180 + .../Models/ImportJobUpdate.TypeConverter.cs | 147 + .../generated/api/Models/ImportJobUpdate.cs | 93 + .../api/Models/ImportJobUpdate.json.cs | 110 + .../ImportJobUpdateProperties.PowerShell.cs | 162 + ...ImportJobUpdateProperties.TypeConverter.cs | 147 + .../api/Models/ImportJobUpdateProperties.cs | 62 + .../Models/ImportJobUpdateProperties.json.cs | 107 + .../Models/ImportJobUpdateTags.PowerShell.cs | 160 + .../ImportJobUpdateTags.TypeConverter.cs | 147 + .../api/Models/ImportJobUpdateTags.cs | 35 + .../Models/ImportJobUpdateTags.dictionary.cs | 75 + .../api/Models/ImportJobUpdateTags.json.cs | 109 + .../Models/ImportJobsListResult.PowerShell.cs | 174 + .../ImportJobsListResult.TypeConverter.cs | 147 + .../api/Models/ImportJobsListResult.cs | 76 + .../api/Models/ImportJobsListResult.json.cs | 120 + ...pdateAcceptedResponseHeaders.PowerShell.cs | 167 + ...teAcceptedResponseHeaders.TypeConverter.cs | 151 + ...ImportJobsUpdateAcceptedResponseHeaders.cs | 58 + ...tJobsUpdateAcceptedResponseHeaders.json.cs | 107 + .../Models/StorageCacheIdentity.PowerShell.cs | 24 + .../api/Models/StorageCacheIdentity.cs | 78 + .../api/Models/StorageCacheIdentity.json.cs | 6 + .../generated/api/StorageCache.cs | 7448 ++++++++++++++++- ...ileSystemSubnetRequiredSize_GetExpanded.cs | 2 +- .../GetAzStorageCacheAmlFileSystem_Get.cs | 2 +- ...torageCacheAmlFileSystem_GetViaIdentity.cs | 2 +- .../GetAzStorageCacheAmlFileSystem_List.cs | 2 +- .../GetAzStorageCacheAmlFileSystem_List1.cs | 2 +- .../GetAzStorageCacheAutoExportJob_Get.cs | 526 ++ ...torageCacheAutoExportJob_GetViaIdentity.cs | 489 ++ ...toExportJob_GetViaIdentityAmlFilesystem.cs | 503 ++ .../GetAzStorageCacheAutoExportJob_List.cs | 538 ++ .../GetAzStorageCacheAutoImportJob_Get.cs | 526 ++ ...torageCacheAutoImportJob_GetViaIdentity.cs | 489 ++ ...toImportJob_GetViaIdentityAmlFilesystem.cs | 503 ++ .../GetAzStorageCacheAutoImportJob_List.cs | 538 ++ .../cmdlets/GetAzStorageCacheImportJob_Get.cs | 526 ++ ...tAzStorageCacheImportJob_GetViaIdentity.cs | 489 ++ ...heImportJob_GetViaIdentityAmlFilesystem.cs | 503 ++ .../GetAzStorageCacheImportJob_List.cs | 536 ++ ...cheAmlFileSystemArchive_ArchiveExpanded.cs | 4 +- ...ystemArchive_ArchiveViaIdentityExpanded.cs | 4 +- ...ileSystemArchive_ArchiveViaJsonFilePath.cs | 4 +- ...lFileSystemArchive_ArchiveViaJsonString.cs | 4 +- ...torageCacheAmlFileSystem_CreateExpanded.cs | 108 +- ...AmlFileSystem_CreateViaIdentityExpanded.cs | 108 +- ...acheAmlFileSystem_CreateViaJsonFilePath.cs | 35 +- ...eCacheAmlFileSystem_CreateViaJsonString.cs | 35 +- ...torageCacheAutoExportJob_CreateExpanded.cs | 637 ++ ..._CreateViaIdentityAmlFilesystemExpanded.cs | 617 ++ ...AutoExportJob_CreateViaIdentityExpanded.cs | 601 ++ ...acheAutoExportJob_CreateViaJsonFilePath.cs | 595 ++ ...eCacheAutoExportJob_CreateViaJsonString.cs | 593 ++ ...torageCacheAutoImportJob_CreateExpanded.cs | 684 ++ ..._CreateViaIdentityAmlFilesystemExpanded.cs | 664 ++ ...AutoImportJob_CreateViaIdentityExpanded.cs | 648 ++ ...acheAutoImportJob_CreateViaJsonFilePath.cs | 595 ++ ...eCacheAutoImportJob_CreateViaJsonString.cs | 593 ++ ...wAzStorageCacheImportJob_CreateExpanded.cs | 669 ++ ..._CreateViaIdentityAmlFilesystemExpanded.cs | 649 ++ ...acheImportJob_CreateViaIdentityExpanded.cs | 631 ++ ...ageCacheImportJob_CreateViaJsonFilePath.cs | 595 ++ ...orageCacheImportJob_CreateViaJsonString.cs | 593 ++ ...emoveAzStorageCacheAmlFileSystem_Delete.cs | 20 +- ...ageCacheAmlFileSystem_DeleteViaIdentity.cs | 20 +- ...emoveAzStorageCacheAutoExportJob_Delete.cs | 616 ++ ...ageCacheAutoExportJob_DeleteViaIdentity.cs | 578 ++ ...xportJob_DeleteViaIdentityAmlFilesystem.cs | 596 ++ ...emoveAzStorageCacheAutoImportJob_Delete.cs | 616 ++ ...ageCacheAutoImportJob_DeleteViaIdentity.cs | 578 ++ ...mportJob_DeleteViaIdentityAmlFilesystem.cs | 596 ++ .../RemoveAzStorageCacheImportJob_Delete.cs | 616 ++ ...StorageCacheImportJob_DeleteViaIdentity.cs | 578 ++ ...mportJob_DeleteViaIdentityAmlFilesystem.cs | 595 ++ ...StorageCacheAmlFilesystemArchive_Cancel.cs | 4 +- ...eAmlFilesystemArchive_CancelViaIdentity.cs | 4 +- ...eCacheAmlFileSystemSubnet_CheckExpanded.cs | 4 +- ...mlFileSystemSubnet_CheckViaJsonFilePath.cs | 4 +- ...eAmlFileSystemSubnet_CheckViaJsonString.cs | 4 +- ...torageCacheAmlFileSystem_UpdateExpanded.cs | 84 +- ...AmlFileSystem_UpdateViaIdentityExpanded.cs | 84 +- ...acheAmlFileSystem_UpdateViaJsonFilePath.cs | 35 +- ...eCacheAmlFileSystem_UpdateViaJsonString.cs | 35 +- ...torageCacheAutoExportJob_UpdateExpanded.cs | 609 ++ ..._UpdateViaIdentityAmlFilesystemExpanded.cs | 589 ++ ...AutoExportJob_UpdateViaIdentityExpanded.cs | 573 ++ ...acheAutoExportJob_UpdateViaJsonFilePath.cs | 595 ++ ...eCacheAutoExportJob_UpdateViaJsonString.cs | 593 ++ ...torageCacheAutoImportJob_UpdateExpanded.cs | 609 ++ ..._UpdateViaIdentityAmlFilesystemExpanded.cs | 589 ++ ...AutoImportJob_UpdateViaIdentityExpanded.cs | 573 ++ ...acheAutoImportJob_UpdateViaJsonFilePath.cs | 595 ++ ...eCacheAutoImportJob_UpdateViaJsonString.cs | 593 ++ ...eAzStorageCacheImportJob_UpdateExpanded.cs | 609 ++ ..._UpdateViaIdentityAmlFilesystemExpanded.cs | 589 ++ ...acheImportJob_UpdateViaIdentityExpanded.cs | 571 ++ ...ageCacheImportJob_UpdateViaJsonFilePath.cs | 595 ++ ...orageCacheImportJob_UpdateViaJsonString.cs | 593 ++ .../runtime/BuildTime/Models/PsHelpTypes.cs | 11 +- .../runtime/BuildTime/Models/PsProxyTypes.cs | 1 + .../generated/runtime/Context.cs | 2 +- .../generated/runtime/MessageAttribute.cs | 11 +- .../runtime/Properties/Resources.resx | 2 +- 245 files changed, 68311 insertions(+), 976 deletions(-) create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoExportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoExportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoExportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoExportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheImportJob.ps1 create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.dictionary.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.dictionary.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.dictionary.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.json.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_Get.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_List.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_Get.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_List.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_Get.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_List.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonString.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonString.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonString.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_Delete.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_Delete.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_Delete.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentity.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath.cs create mode 100644 generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonString.cs diff --git a/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.format.ps1xml b/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.format.ps1xml index 19bff8ac9b07..9aabb9c72562 100644 --- a/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.format.ps1xml +++ b/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.format.ps1xml @@ -403,22 +403,940 @@ + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings#Multiple + + + + + + + + + + + + + + + + + + + + + + + + Mode + + + NoSquashNidList + + + SquashGid + + + SquashUid + + + Status + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsListResult - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsListResult#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsListResult#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemSubnetInfo + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemSubnetInfo#Multiple + + + + + + + + + + + + + + + + + + FilesystemSubnet + + + Location + + + StorageCapacityTiB + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsUpdateAcceptedResponseHeaders + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsUpdateAcceptedResponseHeaders#Multiple + + + + + + + + + + + + AzureAsyncOperation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow#Multiple + + + + + + + + + + + + + + + DayOfWeek + + + TimeOfDayUtc + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + AzureAsyncOperation + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobProperties + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobProperties#Multiple + + + + + + + + + + + + + + + AdminStatus + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatus + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatus#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CurrentIterationFilesDiscovered + + + CurrentIterationFilesExported + + + CurrentIterationFilesFailed + + + CurrentIterationMiBDiscovered + + + CurrentIterationMiBExported + + + ExportIterationCount + + + LastCompletionTimeUtc + + + LastStartedTimeUtc + + + LastSuccessfulIterationCompletionTimeUtc + + + State + + + StatusCode + + + StatusMessage + + + TotalFilesExported + + + TotalFilesFailed + + + TotalMiBExported + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsListResult + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsListResult#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsUpdateAcceptedResponseHeaders + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsUpdateAcceptedResponseHeaders#Multiple + + + + + + + + + + + + AzureAsyncOperation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateProperties + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateProperties#Multiple + + + + + + + + + + + + AdminStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + AzureAsyncOperation + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobProperties + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + AdminStatus + + + ConflictResolutionMode + + + EnableDeletion + + + MaximumError + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatus + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatus#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ImportedDirectory + + + ImportedFile + + + ImportedSymlink + + + LastCompletionTimeUtc + + + LastStartedTimeUtc + + + PreexistingDirectory + + + PreexistingFile + + + PreexistingSymlink + + + RateOfBlobImport + + + RateOfBlobWalk + + + ScanEndTime + + + ScanStartTime + + + State + + + StatusCode + + + StatusMessage + + + TotalBlobsImported + + + TotalBlobsWalked + + + TotalConflict + + + TotalError + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEvents + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEvents#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deletion + + + ImportedDirectory + + + ImportedFile + + + ImportedSymlink + + + LastChangeFeedEventConsumedTime + + + LastTimeFullySynchronized + + + PreexistingDirectory + + + PreexistingFile + + + PreexistingSymlink + + + RateOfBlobImport + + + TotalBlobsImported + + + TotalConflict + + + TotalError + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsListResult + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsListResult#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsUpdateAcceptedResponseHeaders + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsUpdateAcceptedResponseHeaders#Multiple + + + + + + + + + + + + AzureAsyncOperation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateProperties + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateProperties#Multiple + + + + + + + + + + + + AdminStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTags#Multiple + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudErrorBody + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudErrorBody#Multiple - + + + + + + + - NextLink + Code + + + Message + + + Target @@ -426,33 +1344,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemSubnetInfo + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemSubnetInfo#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail#Multiple - + - + - + - FilesystemSubnet + Code - Location + Message - StorageCapacityTiB + Target @@ -460,49 +1378,115 @@ - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsUpdateAcceptedResponseHeaders + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemsUpdateAcceptedResponseHeaders#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + AzureAsyncOperation + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobProperties - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobProperties#Multiple - + - + + + + + + + - DayOfWeek + AdminStatus - TimeOfDayUtc + ConflictResolutionMode + + + MaximumError + + + ProvisioningState @@ -510,21 +1494,111 @@ - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateTags + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatus - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateTags#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatus#Multiple - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Item + BlobsImportedPerSecond + + + BlobsWalkedPerSecond + + + ImportedDirectory + + + ImportedFile + + + ImportedSymlink + + + LastCompletionTime + + + LastStartedTime + + + PreexistingDirectory + + + PreexistingFile + + + PreexistingSymlink + + + State + + + StatusMessage + + + TotalBlobsImported + + + TotalBlobsWalked + + + TotalConflict + + + TotalError @@ -532,33 +1606,87 @@ - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudErrorBody + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsListResult - Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudErrorBody#Multiple + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsListResult#Multiple - - - - + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsUpdateAcceptedResponseHeaders + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsUpdateAcceptedResponseHeaders#Multiple + + + - + - Code + AzureAsyncOperation + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateProperties + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateProperties#Multiple + + + + + + + + + + - Message + AdminStatus + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTags#Multiple + + + + + + + + + + - Target + Item @@ -685,6 +1813,15 @@ + + + + + + + + + @@ -698,6 +1835,15 @@ AmlFilesystemName + + AutoExportJobName + + + AutoImportJobName + + + ImportJobName + ResourceGroupName diff --git a/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.psd1 b/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.psd1 index cff7b5e792f5..42edf463f252 100644 --- a/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.psd1 +++ b/generated/StorageCache/StorageCache.Autorest/Az.StorageCache.psd1 @@ -11,7 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.StorageCache.private.dll' FormatsToProcess = './Az.StorageCache.format.ps1xml' - FunctionsToExport = 'Get-AzStorageCacheAmlFileSystem', 'Get-AzStorageCacheAmlFileSystemSubnetRequiredSize', 'Invoke-AzStorageCacheAmlFileSystemArchive', 'New-AzStorageCacheAmlFileSystem', 'Remove-AzStorageCacheAmlFileSystem', 'Stop-AzStorageCacheAmlFilesystemArchive', 'Test-AzStorageCacheAmlFileSystemSubnet', 'Update-AzStorageCacheAmlFileSystem' + FunctionsToExport = 'Get-AzStorageCacheAmlFileSystem', 'Get-AzStorageCacheAmlFileSystemSubnetRequiredSize', 'Get-AzStorageCacheAutoExportJob', 'Get-AzStorageCacheAutoImportJob', 'Get-AzStorageCacheImportJob', 'Invoke-AzStorageCacheAmlFileSystemArchive', 'New-AzStorageCacheAmlFileSystem', 'New-AzStorageCacheAutoExportJob', 'New-AzStorageCacheAutoImportJob', 'New-AzStorageCacheImportJob', 'Remove-AzStorageCacheAmlFileSystem', 'Remove-AzStorageCacheAutoExportJob', 'Remove-AzStorageCacheAutoImportJob', 'Remove-AzStorageCacheImportJob', 'Stop-AzStorageCacheAmlFilesystemArchive', 'Test-AzStorageCacheAmlFileSystemSubnet', 'Update-AzStorageCacheAmlFileSystem', 'Update-AzStorageCacheAutoExportJob', 'Update-AzStorageCacheAutoImportJob', 'Update-AzStorageCacheImportJob' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'StorageCache' diff --git a/generated/StorageCache/StorageCache.Autorest/Properties/AssemblyInfo.cs b/generated/StorageCache/StorageCache.Autorest/Properties/AssemblyInfo.cs index d0e805ce102f..51c35264bbcb 100644 --- a/generated/StorageCache/StorageCache.Autorest/Properties/AssemblyInfo.cs +++ b/generated/StorageCache/StorageCache.Autorest/Properties/AssemblyInfo.cs @@ -20,9 +20,17 @@ [assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] [assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] [assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - StorageCache")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.2")] -[assembly: System.Reflection.AssemblyVersionAttribute("0.1.2")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.2.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.2.0")] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.CLSCompliantAttribute(false)] + + + + + + + + diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAmlFileSystem.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAmlFileSystem.ps1 index 7232d3a4feed..5dd6da6c75ae 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAmlFileSystem.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAmlFileSystem.ps1 @@ -37,7 +37,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoExportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoExportJob.ps1 new file mode 100644 index 000000000000..e2ef63a79f6e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoExportJob.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns an auto export job. +.Description +Returns an auto export job. +.Example +Get-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheautoexportjob +#> +function Get-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoImportJob.ps1 new file mode 100644 index 000000000000..47a8d886f330 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheAutoImportJob.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns an auto import job. +.Description +Returns an auto import job. +.Example +Get-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheautoimportjob +#> +function Get-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheImportJob.ps1 new file mode 100644 index 000000000000..d19c2c3b5cd2 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Get-AzStorageCacheImportJob.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns an import job. +.Description +Returns an import job. +.Example +Get-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheimportjob +#> +function Get-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Invoke-AzStorageCacheAmlFileSystemArchive.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Invoke-AzStorageCacheAmlFileSystemArchive.ps1 index 90306b15adf9..7416ee1a61d4 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/Invoke-AzStorageCacheAmlFileSystemArchive.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/Invoke-AzStorageCacheAmlFileSystemArchive.ps1 @@ -35,7 +35,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link diff --git a/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAmlFileSystem.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAmlFileSystem.ps1 index c16218b65485..c1e8b89957b8 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAmlFileSystem.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAmlFileSystem.ps1 @@ -16,9 +16,9 @@ <# .Synopsis -create an AML file system. +Create an AML file system. .Description -create an AML file system. +Create an AML file system. .Example New-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -Location eastus -UserAssignedIdentity "/subscriptions/{subId}/resourcegroups/azps_test_gp_storagecache/providers/Microsoft.ManagedIdentity/userAssignedIdentities/azps-management-identity" -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" -MaintenanceWindowDayOfWeek 'Saturday' -MaintenanceWindowTimeOfDayUtc "03:00" -FilesystemSubnet "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/azps-vnetwork-sub-kv" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -Zone 1 .Example @@ -35,7 +35,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link @@ -124,6 +127,38 @@ param( # The time of day (in UTC) to start the maintenance window. ${MaintenanceWindowTimeOfDayUtc}, + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Squash mode of the AML file system. + # 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. + # 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. + # 'None': No squashing of User and Group IDs is performed for any users on any systems. + ${RootSquashSettingMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + ${RootSquashSettingNoSquashNidList}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Group ID to squash to. + ${RootSquashSettingSquashGid}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # User ID to squash to. + ${RootSquashSettingSquashUid}, + [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] @@ -136,9 +171,21 @@ param( [Parameter(ParameterSetName='CreateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] [System.String] - # Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + # Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. + # This is only used during initial creation of the AML file system. + # It automatically creates an import job resource that can be deleted. ${SettingImportPrefix}, + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. + # This is only used during initial creation of the AML file system and has '/' as the default value. + # It automatically creates an import job resource that can be deleted. + ${SettingImportPrefixesInitial}, + [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] diff --git a/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoExportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoExportJob.ps1 new file mode 100644 index 000000000000..998146376934 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoExportJob.ps1 @@ -0,0 +1,322 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an auto export job. +.Description +Create an auto export job. +.Example +New-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -AutoExportPrefix @('/path1') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheautoexportjob +#> +function New-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto export job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto export job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get auto exported to the cluster namespace. + # It has '/' as the default value. + # Number of maximum allowed paths for now is 1. + ${AutoExportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoImportJob.ps1 new file mode 100644 index 000000000000..d5cec3b2d725 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheAutoImportJob.ps1 @@ -0,0 +1,356 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an auto import job. +.Description +Create an auto import job. +.Example +New-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -AutoImportPrefix @('/path1', '/path2') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheautoimportjob +#> +function New-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto import job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto import job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get auto imported to the cluster namespace. + # It has '/' as the default value. + # Number of maximum allowed paths is 100. + ${AutoImportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # How the auto import job will handle conflicts. + # For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. + # Fail indicates that the auto import job should stop immediately and not do anything with the conflict. + # Skip indicates that it should pass over the conflict. + # OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + # OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. + # Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes. + ${ConflictResolutionMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether or not to enable deletions during auto import. + # This only affects overwrite-dirty. + ${EnableDeletion}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. + # -1 means infinite. + # 0 means exit immediately on any error. + ${MaximumError}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheImportJob.ps1 new file mode 100644 index 000000000000..27d0e1d56bd5 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/New-AzStorageCacheImportJob.ps1 @@ -0,0 +1,346 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an import job. +.Description +Create an import job. +.Example +New-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -ImportPrefix @('/path1', '/path2') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheimportjob +#> +function New-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the import job. + # Possible values: 'Active', 'Cancel'. + # Passing in a value of 'Cancel' will cancel the current active import job. + # By default it is set to 'Active'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # How the import job will handle conflicts. + # For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. + # Fail indicates that the import job should stop immediately and not do anything with the conflict. + # Skip indicates that it should pass over the conflict. + # OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. + # OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. + # Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes. + ${ConflictResolutionMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get imported into the cluster namespace. + # It has '/' as the default value. + ${ImportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int32] + # Total non-conflict oriented errors the import job will tolerate before exiting with failure. + # -1 means infinite. + # 0 means exit immediately and is the default. + ${MaximumError}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/ProxyCmdletDefinitions.ps1 index d5e45dbb7d84..3b1c854c1a9c 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -219,7 +219,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link @@ -412,38 +415,47 @@ end { <# .Synopsis -Archive data from the AML file system. +Returns an auto export job. .Description -Archive data from the AML file system. -.Example -Invoke-AzStorageCacheAmlFileSystemArchive -AmlFilesystemName azps-cache-fs-4 -ResourceGroupName azps_test_gp_storagecache +Returns an auto export job. .Example -Invoke-AzStorageCacheAmlFileSystemArchive -AmlFilesystemName azps-cache-fs-4 -ResourceGroupName azps_test_gp_storagecache -PassThru +Get-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' .Inputs Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/invoke-azstoragecacheamlfilesystemarchive +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheautoexportjob #> -function Invoke-AzStorageCacheAmlFileSystemArchive { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='ArchiveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(ParameterSetName='ArchiveExpanded', Mandatory)] - [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # Name for the AML file system. @@ -451,49 +463,43 @@ param( # Start and end with alphanumeric. ${AmlFilesystemName}, - [Parameter(ParameterSetName='ArchiveExpanded', Mandatory)] - [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='ArchiveExpanded')] - [Parameter(ParameterSetName='ArchiveViaJsonFilePath')] - [Parameter(ParameterSetName='ArchiveViaJsonString')] + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] - [System.String] + [System.String[]] # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='ArchiveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] # Identity Parameter ${InputObject}, - [Parameter(ParameterSetName='ArchiveExpanded')] - [Parameter(ParameterSetName='ArchiveViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Lustre file system path to archive relative to the file system root. - # Specify '/' to archive all modified data. - ${FilesystemPath}, - - [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Path of Json file supplied to the Archive operation - ${JsonFilePath}, - - [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Json string supplied to the Archive operation - ${JsonString}, + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -524,12 +530,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Uri] @@ -585,12 +585,12 @@ begin { } $mapping = @{ - ArchiveExpanded = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveExpanded'; - ArchiveViaIdentityExpanded = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded'; - ArchiveViaJsonFilePath = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath'; - ArchiveViaJsonString = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString'; + Get = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheAutoExportJob_List'; } - if (('ArchiveExpanded', 'ArchiveViaJsonFilePath', 'ArchiveViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -652,197 +652,91 @@ end { <# .Synopsis -create an AML file system. +Returns an auto import job. .Description -create an AML file system. -.Example -New-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -Location eastus -UserAssignedIdentity "/subscriptions/{subId}/resourcegroups/azps_test_gp_storagecache/providers/Microsoft.ManagedIdentity/userAssignedIdentities/azps-management-identity" -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" -MaintenanceWindowDayOfWeek 'Saturday' -MaintenanceWindowTimeOfDayUtc "03:00" -FilesystemSubnet "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/azps-vnetwork-sub-kv" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -Zone 1 +Returns an auto import job. .Example -New-AzStorageCacheAmlFileSystem -Name azps-cache-fs-hsm -ResourceGroupName azps_test_gp_storagecache -Location eastus -MaintenanceWindowDayOfWeek 'Saturday' -MaintenanceWindowTimeOfDayUtc "03:00" -FilesystemSubnet "/subscriptions/{subId}/resourcegroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/default" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -Zone 1 -SettingContainer "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Storage/storageAccounts/azpssa/blobServices/default/containers/az-blob-login" -SettingImportPrefix "/" -SettingLoggingContainer "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Storage/storageAccounts/azpssa/blobServices/default/containers/az-blob" +Get-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' .Inputs Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheamlfilesystem +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheautoimportjob #> -function New-AzStorageCacheAmlFileSystem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(ParameterSetName='CreateExpanded', Mandatory)] - [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] - [Alias('AmlFilesystemName')] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # Name for the AML file system. # Allows alphanumerics, underscores, and hyphens. # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. ${Name}, - [Parameter(ParameterSetName='CreateExpanded', Mandatory)] - [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaJsonFilePath')] - [Parameter(ParameterSetName='CreateViaJsonString')] + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] - [System.String] + [System.String[]] # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] # Identity Parameter ${InputObject}, - [Parameter(ParameterSetName='CreateExpanded', Mandatory)] - [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # The geo-location where the resource lives - ${Location}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Determines whether to enable a system-assigned identity for the resource. - ${EnableSystemAssignedIdentity}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Subnet used for managing the AML file system and for client-facing operations. - # This subnet should have at least a /24 subnet mask within the VNET's address space. - ${FilesystemSubnet}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # The URL referencing a key encryption key in key vault. - ${KeyEncryptionKeyUrl}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Day of the week on which the maintenance window will occur. - ${MaintenanceWindowDayOfWeek}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # The time of day (in UTC) to start the maintenance window. - ${MaintenanceWindowTimeOfDayUtc}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Resource ID of storage container used for hydrating the namespace and archiving from the namespace. - # The resource provider must have permission to create SAS tokens on the storage account. - ${SettingContainer}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. - ${SettingImportPrefix}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Resource ID of storage container used for logging events and errors. - # Must be a separate container in the same storage account as the hydration and archive container. - # The resource provider must have permission to create SAS tokens on the storage account. - ${SettingLoggingContainer}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # SKU name for this resource. - ${SkuName}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Resource Id. - ${SourceVaultId}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.Single] - # The size of the AML file system, in TiB. - # This might be rounded up. - ${StorageCapacityTiB}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] - [System.Collections.Hashtable] - # Resource tags. - ${Tag}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String[]] - # The array of user assigned identities associated with the resource. - # The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' - ${UserAssignedIdentity}, - - [Parameter(ParameterSetName='CreateExpanded')] - [Parameter(ParameterSetName='CreateViaIdentityExpanded')] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String[]] - # Availability zones for resources. - # This field should only contain a single element in the array. - ${Zone}, - - [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Path of Json file supplied to the Create operation - ${JsonFilePath}, - - [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Json string supplied to the Create operation - ${JsonString}, + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -853,12 +747,6 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Run the command as a job - ${AsJob}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -879,12 +767,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Run the command asynchronously - ${NoWait}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Uri] @@ -940,12 +822,3282 @@ begin { } $mapping = @{ - CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateExpanded'; - CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateViaIdentityExpanded'; - CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateViaJsonFilePath'; + Get = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheAutoImportJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Returns an import job. +.Description +Returns an import job. +.Example +Get-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -ResourceGroupName 'myresourcegroup' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/get-azstoragecacheimportjob +#> +function Get-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='GetViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_Get'; + GetViaIdentity = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_GetViaIdentity'; + GetViaIdentityAmlFilesystem = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_GetViaIdentityAmlFilesystem'; + List = 'Az.StorageCache.private\Get-AzStorageCacheImportJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Archive data from the AML file system. +.Description +Archive data from the AML file system. +.Example +Invoke-AzStorageCacheAmlFileSystemArchive -AmlFilesystemName azps-cache-fs-4 -ResourceGroupName azps_test_gp_storagecache +.Example +Invoke-AzStorageCacheAmlFileSystemArchive -AmlFilesystemName azps-cache-fs-4 -ResourceGroupName azps_test_gp_storagecache -PassThru + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/invoke-azstoragecacheamlfilesystemarchive +#> +function Invoke-AzStorageCacheAmlFileSystemArchive { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ArchiveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ArchiveExpanded', Mandatory)] + [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='ArchiveExpanded', Mandatory)] + [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ArchiveExpanded')] + [Parameter(ParameterSetName='ArchiveViaJsonFilePath')] + [Parameter(ParameterSetName='ArchiveViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ArchiveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='ArchiveExpanded')] + [Parameter(ParameterSetName='ArchiveViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Lustre file system path to archive relative to the file system root. + # Specify '/' to archive all modified data. + ${FilesystemPath}, + + [Parameter(ParameterSetName='ArchiveViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Archive operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='ArchiveViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Archive operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ArchiveExpanded = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveExpanded'; + ArchiveViaIdentityExpanded = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded'; + ArchiveViaJsonFilePath = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath'; + ArchiveViaJsonString = 'Az.StorageCache.private\Invoke-AzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString'; + } + if (('ArchiveExpanded', 'ArchiveViaJsonFilePath', 'ArchiveViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an AML file system. +.Description +Create an AML file system. +.Example +New-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -Location eastus -UserAssignedIdentity "/subscriptions/{subId}/resourcegroups/azps_test_gp_storagecache/providers/Microsoft.ManagedIdentity/userAssignedIdentities/azps-management-identity" -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" -MaintenanceWindowDayOfWeek 'Saturday' -MaintenanceWindowTimeOfDayUtc "03:00" -FilesystemSubnet "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/azps-vnetwork-sub-kv" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -Zone 1 +.Example +New-AzStorageCacheAmlFileSystem -Name azps-cache-fs-hsm -ResourceGroupName azps_test_gp_storagecache -Location eastus -MaintenanceWindowDayOfWeek 'Saturday' -MaintenanceWindowTimeOfDayUtc "03:00" -FilesystemSubnet "/subscriptions/{subId}/resourcegroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/default" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -Zone 1 -SettingContainer "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Storage/storageAccounts/azpssa/blobServices/default/containers/az-blob-login" -SettingImportPrefix "/" -SettingLoggingContainer "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Storage/storageAccounts/azpssa/blobServices/default/containers/az-blob" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheamlfilesystem +#> +function New-AzStorageCacheAmlFileSystem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('AmlFilesystemName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Determines whether to enable a system-assigned identity for the resource. + ${EnableSystemAssignedIdentity}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Subnet used for managing the AML file system and for client-facing operations. + # This subnet should have at least a /24 subnet mask within the VNET's address space. + ${FilesystemSubnet}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The URL referencing a key encryption key in key vault. + ${KeyEncryptionKeyUrl}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Day of the week on which the maintenance window will occur. + ${MaintenanceWindowDayOfWeek}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The time of day (in UTC) to start the maintenance window. + ${MaintenanceWindowTimeOfDayUtc}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Squash mode of the AML file system. + # 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. + # 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. + # 'None': No squashing of User and Group IDs is performed for any users on any systems. + ${RootSquashSettingMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + ${RootSquashSettingNoSquashNidList}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Group ID to squash to. + ${RootSquashSettingSquashGid}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # User ID to squash to. + ${RootSquashSettingSquashUid}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Resource ID of storage container used for hydrating the namespace and archiving from the namespace. + # The resource provider must have permission to create SAS tokens on the storage account. + ${SettingContainer}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. + # This is only used during initial creation of the AML file system. + # It automatically creates an import job resource that can be deleted. + ${SettingImportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. + # This is only used during initial creation of the AML file system and has '/' as the default value. + # It automatically creates an import job resource that can be deleted. + ${SettingImportPrefixesInitial}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Resource ID of storage container used for logging events and errors. + # Must be a separate container in the same storage account as the hydration and archive container. + # The resource provider must have permission to create SAS tokens on the storage account. + ${SettingLoggingContainer}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # SKU name for this resource. + ${SkuName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Resource Id. + ${SourceVaultId}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Single] + # The size of the AML file system, in TiB. + # This might be rounded up. + ${StorageCapacityTiB}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # The array of user assigned identities associated with the resource. + # The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' + ${UserAssignedIdentity}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # Availability zones for resources. + # This field should only contain a single element in the array. + ${Zone}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateViaJsonFilePath'; CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheAmlFileSystem_CreateViaJsonString'; } - if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an auto export job. +.Description +Create an auto export job. +.Example +New-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -AutoExportPrefix @('/path1') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheautoexportjob +#> +function New-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto export job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto export job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get auto exported to the cluster namespace. + # It has '/' as the default value. + # Number of maximum allowed paths for now is 1. + ${AutoExportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheAutoExportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an auto import job. +.Description +Create an auto import job. +.Example +New-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -AutoImportPrefix @('/path1', '/path2') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheautoimportjob +#> +function New-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto import job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto import job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get auto imported to the cluster namespace. + # It has '/' as the default value. + # Number of maximum allowed paths is 100. + ${AutoImportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # How the auto import job will handle conflicts. + # For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. + # Fail indicates that the auto import job should stop immediately and not do anything with the conflict. + # Skip indicates that it should pass over the conflict. + # OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + # OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. + # Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes. + ${ConflictResolutionMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether or not to enable deletions during auto import. + # This only affects overwrite-dirty. + ${EnableDeletion}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. + # -1 means infinite. + # 0 means exit immediately on any error. + ${MaximumError}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheAutoImportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an import job. +.Description +Create an import job. +.Example +New-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -Location 'East US' -ImportPrefix @('/path1', '/path2') + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/new-azstoragecacheimportjob +#> +function New-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaJsonFilePath')] + [Parameter(ParameterSetName='CreateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the import job. + # Possible values: 'Active', 'Cancel'. + # Passing in a value of 'Cancel' will cancel the current active import job. + # By default it is set to 'Active'. + ${AdminStatus}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # How the import job will handle conflicts. + # For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. + # Fail indicates that the import job should stop immediately and not do anything with the conflict. + # Skip indicates that it should pass over the conflict. + # OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. + # OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. + # Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes. + ${ConflictResolutionMode}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String[]] + # An array of blob paths/prefixes that get imported into the cluster namespace. + # It has '/' as the default value. + ${ImportPrefix}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int32] + # Total non-conflict oriented errors the import job will tolerate before exiting with failure. + # -1 means infinite. + # 0 means exit immediately and is the default. + ${MaximumError}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateExpanded'; + CreateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded'; + CreateViaIdentityExpanded = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaIdentityExpanded'; + CreateViaJsonFilePath = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.StorageCache.private\New-AzStorageCacheImportJob_CreateViaJsonString'; + } + if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Schedules an AML file system for deletion. +.Description +Schedules an AML file system for deletion. +.Example +Remove-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache +.Example +Get-AzStorageCacheAmlFileSystem -ResourceGroupName azps_test_gp_storagecache -Name azps-cache-fs | Remove-AzStorageCacheAmlFileSystem + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheamlfilesystem +#> +function Remove-AzStorageCacheAmlFileSystem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('AmlFilesystemName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAmlFileSystem_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAmlFileSystem_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Schedules an auto export job for deletion. +.Description +Schedules an auto export job for deletion. +.Example +Remove-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheautoexportjob +#> +function Remove-AzStorageCacheAutoExportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Schedules an auto import job for deletion. +.Description +Schedules an auto import job for deletion. +.Example +Remove-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheautoimportjob +#> +function Remove-AzStorageCacheAutoImportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Schedules an import job for deletion. +.Description +Schedules an import job for deletion. +.Example +Remove-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheimportjob +#> +function Remove-AzStorageCacheImportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Cancel archiving data from the AML file system. +.Description +Cancel archiving data from the AML file system. +.Example +Stop-AzStorageCacheAmlFilesystemArchive -AmlFilesystemName azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -PassThru + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/stop-azstoragecacheamlfilesystemarchive +#> +function Stop-AzStorageCacheAmlFilesystemArchive { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.StorageCache.private\Stop-AzStorageCacheAmlFilesystemArchive_Cancel'; + CancelViaIdentity = 'Az.StorageCache.private\Stop-AzStorageCacheAmlFilesystemArchive_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Check that subnets will be valid for AML file system check calls. +.Description +Check that subnets will be valid for AML file system check calls. +.Example +Test-AzStorageCacheAmlFileSystemSubnet -Location eastus -Name "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/azps-vnetwork-sub-kv" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -PassThru + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/test-azstoragecacheamlfilesystemsubnet +#> +function Test-AzStorageCacheAmlFileSystemSubnet { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Region that the AML file system will be created in. + ${Location}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Subnet used for managing the AML file system and for client-facing operations. + # This subnet should have at least a /24 subnet mask within the VNET's address space. + ${Name}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # SKU name for this resource. + ${SkuName}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Single] + # The size of the AML file system, in TiB. + ${StorageCapacityTiB}, + + [Parameter(ParameterSetName='CheckViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Check operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CheckViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Check operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CheckExpanded = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckExpanded'; + CheckViaJsonFilePath = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath'; + CheckViaJsonString = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckViaJsonString'; + } + if (('CheckExpanded', 'CheckViaJsonFilePath', 'CheckViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1007,18 +4159,16 @@ end { <# .Synopsis -Schedules an AML file system for deletion. +Update an AML file system instance. .Description -Schedules an AML file system for deletion. -.Example -Remove-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache +Update an AML file system instance. .Example -Get-AzStorageCacheAmlFileSystem -ResourceGroupName azps_test_gp_storagecache -Name azps-cache-fs | Remove-AzStorageCacheAmlFileSystem +Update-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -MaintenanceWindowDayOfWeek 'Monday' -MaintenanceWindowTimeOfDayUtc "03:00" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" .Inputs Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem .Notes COMPLEX PARAMETER PROPERTIES @@ -1026,17 +4176,22 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheamlfilesystem +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheamlfilesystem #> -function Remove-AzStorageCacheAmlFileSystem { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Update-AzStorageCacheAmlFileSystem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Alias('AmlFilesystemName')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] @@ -1045,26 +4200,111 @@ param( # Start and end with alphanumeric. ${Name}, - [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='Delete')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] # Identity Parameter ${InputObject}, + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The URL referencing a key encryption key in key vault. + ${KeyEncryptionKeyUrl}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Day of the week on which the maintenance window will occur. + ${MaintenanceWindowDayOfWeek}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The time of day (in UTC) to start the maintenance window. + ${MaintenanceWindowTimeOfDayUtc}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Squash mode of the AML file system. + # 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. + # 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. + # 'None': No squashing of User and Group IDs is performed for any users on any systems. + ${RootSquashSettingMode}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + ${RootSquashSettingNoSquashNidList}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Group ID to squash to. + ${RootSquashSettingSquashGid}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # User ID to squash to. + ${RootSquashSettingSquashUid}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Resource Id. + ${SourceVaultId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1103,14 +4343,8 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] - # Run the command asynchronously - ${NoWait}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, + # Run the command asynchronously + ${NoWait}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] @@ -1167,10 +4401,12 @@ begin { } $mapping = @{ - Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAmlFileSystem_Delete'; - DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAmlFileSystem_DeleteViaIdentity'; + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaJsonString'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1232,34 +4468,48 @@ end { <# .Synopsis -Cancel archiving data from the AML file system. +Update an auto export job instance. .Description -Cancel archiving data from the AML file system. +Update an auto export job instance. .Example -Stop-AzStorageCacheAmlFilesystemArchive -AmlFilesystemName azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -PassThru +Update-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Disable' .Inputs Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/stop-azstoragecacheamlfilesystemarchive +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheautoexportjob #> -function Stop-AzStorageCacheAmlFilesystemArchive { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Update-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Cancel', Mandatory)] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # Name for the AML file system. @@ -1267,26 +4517,81 @@ param( # Start and end with alphanumeric. ${AmlFilesystemName}, - [Parameter(ParameterSetName='Cancel', Mandatory)] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='Cancel')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] # Identity Parameter ${InputObject}, + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto export job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto export job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1296,6 +4601,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -1319,8 +4630,8 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, + # Run the command asynchronously + ${NoWait}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] @@ -1377,10 +4688,13 @@ begin { } $mapping = @{ - Cancel = 'Az.StorageCache.private\Stop-AzStorageCacheAmlFilesystemArchive_Cancel'; - CancelViaIdentity = 'Az.StorageCache.private\Stop-AzStorageCacheAmlFilesystemArchive_CancelViaIdentity'; + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaJsonString'; } - if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1442,63 +4756,128 @@ end { <# .Synopsis -Check that subnets will be valid for AML file system check calls. +Update an auto import job instance. .Description -Check that subnets will be valid for AML file system check calls. +Update an auto import job instance. .Example -Test-AzStorageCacheAmlFileSystemSubnet -Location eastus -Name "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.Network/virtualNetworks/azps-virtual-network/subnets/azps-vnetwork-sub-kv" -SkuName "AMLFS-Durable-Premium-250" -StorageCapacityTiB 16 -PassThru +Update-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Disable' +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/test-azstoragecacheamlfilesystemsubnet +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheautoimportjob #> -function Test-AzStorageCacheAmlFileSystemSubnet { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Update-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='CheckExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Region that the AML file system will be created in. - ${Location}, + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, - [Parameter(ParameterSetName='CheckExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Subnet used for managing the AML file system and for client-facing operations. - # This subnet should have at least a /24 subnet mask within the VNET's address space. - ${Name}, + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, - [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] [System.String] - # SKU name for this resource. - ${SkuName}, + # The administrative status of the auto import job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto import job. + # By default it is set to 'Enable'. + ${AdminStatus}, - [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.Single] - # The size of the AML file system, in TiB. - ${StorageCapacityTiB}, + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, - [Parameter(ParameterSetName='CheckViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] [System.String] - # Path of Json file supplied to the Check operation + # Path of Json file supplied to the Update operation ${JsonFilePath}, - [Parameter(ParameterSetName='CheckViaJsonString', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] [System.String] - # Json string supplied to the Check operation + # Json string supplied to the Update operation ${JsonString}, [Parameter()] @@ -1510,6 +4889,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -1533,8 +4918,8 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, + # Run the command asynchronously + ${NoWait}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] @@ -1591,11 +4976,13 @@ begin { } $mapping = @{ - CheckExpanded = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckExpanded'; - CheckViaJsonFilePath = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath'; - CheckViaJsonString = 'Az.StorageCache.private\Test-AzStorageCacheAmlFileSystemSubnet_CheckViaJsonString'; + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaJsonString'; } - if (('CheckExpanded', 'CheckViaJsonFilePath', 'CheckViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1657,42 +5044,65 @@ end { <# .Synopsis -update an AML file system instance. +Update an import job instance. .Description -update an AML file system instance. +Update an import job instance. .Example -Update-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -MaintenanceWindowDayOfWeek 'Monday' -MaintenanceWindowTimeOfDayUtc "03:00" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" +Update-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Cancel' .Inputs Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link -https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheamlfilesystem +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheimportjob #> -function Update-AzStorageCacheAmlFileSystem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem])] +function Update-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] - [Alias('AmlFilesystemName')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [System.String] # Name for the AML file system. # Allows alphanumerics, underscores, and hyphens. # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] @@ -1713,6 +5123,12 @@ param( # The ID of the target subscription. ${SubscriptionId}, + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] @@ -1720,38 +5136,21 @@ param( ${InputObject}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] [System.String] - # The URL referencing a key encryption key in key vault. - ${KeyEncryptionKeyUrl}, - - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Day of the week on which the maintenance window will occur. - ${MaintenanceWindowDayOfWeek}, - - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # The time of day (in UTC) to start the maintenance window. - ${MaintenanceWindowTimeOfDayUtc}, - - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [System.String] - # Resource Id. - ${SourceVaultId}, + # The administrative status of the import job. + # Possible values: 'Active', 'Cancel'. + # Passing in a value of 'Cancel' will cancel the current active import job. + ${AdminStatus}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, @@ -1864,10 +5263,11 @@ begin { } $mapping = @{ - UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateExpanded'; - UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded'; - UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaJsonFilePath'; - UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAmlFileSystem_UpdateViaJsonString'; + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaJsonString'; } if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAmlFileSystem.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAmlFileSystem.ps1 index c24ece30e62b..babb6094f38a 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAmlFileSystem.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAmlFileSystem.ps1 @@ -35,7 +35,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoExportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoExportJob.ps1 new file mode 100644 index 000000000000..aead6c166599 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoExportJob.ps1 @@ -0,0 +1,266 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Schedules an auto export job for deletion. +.Description +Schedules an auto export job for deletion. +.Example +Remove-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheautoexportjob +#> +function Remove-AzStorageCacheAutoExportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoImportJob.ps1 new file mode 100644 index 000000000000..377f2d03dc8b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheAutoImportJob.ps1 @@ -0,0 +1,266 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Schedules an auto import job for deletion. +.Description +Schedules an auto import job for deletion. +.Example +Remove-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheautoimportjob +#> +function Remove-AzStorageCacheAutoImportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheImportJob.ps1 new file mode 100644 index 000000000000..9e504efb7b84 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Remove-AzStorageCacheImportJob.ps1 @@ -0,0 +1,266 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Schedules an import job for deletion. +.Description +Schedules an import job for deletion. +.Example +Remove-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -Confirm:$false + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/remove-azstoragecacheimportjob +#> +function Remove-AzStorageCacheImportJob { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityAmlFilesystem', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_Delete'; + DeleteViaIdentity = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_DeleteViaIdentity'; + DeleteViaIdentityAmlFilesystem = 'Az.StorageCache.private\Remove-AzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Stop-AzStorageCacheAmlFilesystemArchive.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Stop-AzStorageCacheAmlFilesystemArchive.ps1 index 82e87ed2ccbe..f7a0c9b0dbd1 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/Stop-AzStorageCacheAmlFilesystemArchive.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/Stop-AzStorageCacheAmlFilesystemArchive.ps1 @@ -33,7 +33,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAmlFileSystem.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAmlFileSystem.ps1 index 7a073c2c9685..544dae755c0e 100644 --- a/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAmlFileSystem.ps1 +++ b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAmlFileSystem.ps1 @@ -16,9 +16,9 @@ <# .Synopsis -update an AML file system instance. +Update an AML file system instance. .Description -update an AML file system instance. +Update an AML file system instance. .Example Update-AzStorageCacheAmlFileSystem -Name azps-cache-fs -ResourceGroupName azps_test_gp_storagecache -KeyEncryptionKeyUrl "https://azps-keyvault.vault.azure.net/keys/azps-kv/4cc795e46f114ce2a65b82b312964e0e" -MaintenanceWindowDayOfWeek 'Monday' -MaintenanceWindowTimeOfDayUtc "03:00" -SourceVaultId "/subscriptions/{subId}/resourceGroups/azps_test_gp_storagecache/providers/Microsoft.KeyVault/vaults/azps-keyvault" @@ -33,7 +33,10 @@ To create the parameters described below, construct a hash table containing the INPUTOBJECT : Identity Parameter [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [SubscriptionId ]: The ID of the target subscription. .Link @@ -100,6 +103,38 @@ param( # The time of day (in UTC) to start the maintenance window. ${MaintenanceWindowTimeOfDayUtc}, + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Squash mode of the AML file system. + # 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. + # 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. + # 'None': No squashing of User and Group IDs is performed for any users on any systems. + ${RootSquashSettingMode}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + ${RootSquashSettingNoSquashNidList}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # Group ID to squash to. + ${RootSquashSettingSquashGid}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.Int64] + # User ID to squash to. + ${RootSquashSettingSquashUid}, + [Parameter(ParameterSetName='UpdateExpanded')] [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoExportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoExportJob.ps1 new file mode 100644 index 000000000000..482a693cdcf6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoExportJob.ps1 @@ -0,0 +1,303 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update an auto export job instance. +.Description +Update an auto export job instance. +.Example +Update-AzStorageCacheAutoExportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoexportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Disable' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheautoexportjob +#> +function Update-AzStorageCacheAutoExportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('AutoExportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto export job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto export job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto export job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAutoExportJob_UpdateViaJsonString'; + } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoImportJob.ps1 new file mode 100644 index 000000000000..a6404036a104 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheAutoImportJob.ps1 @@ -0,0 +1,303 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update an auto import job instance. +.Description +Update an auto import job instance. +.Example +Update-AzStorageCacheAutoImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myautoimportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Disable' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheautoimportjob +#> +function Update-AzStorageCacheAutoImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('AutoImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the auto import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the auto import job. + # Possible values: 'Enable', 'Disable'. + # Passing in a value of 'Disable' will disable the current active auto import job. + # By default it is set to 'Enable'. + ${AdminStatus}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheAutoImportJob_UpdateViaJsonString'; + } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheImportJob.ps1 b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheImportJob.ps1 new file mode 100644 index 000000000000..fbcc93c6a4a0 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/exports/Update-AzStorageCacheImportJob.ps1 @@ -0,0 +1,302 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update an import job instance. +.Description +Update an import job instance. +.Example +Update-AzStorageCacheImportJob -AmlFilesystemName 'myamlfilesystem' -Name 'myimportjob' -ResourceGroupName 'myresourcegroup' -AdminStatus 'Cancel' + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +AMLFILESYSTEMINPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. + +INPUTOBJECT : Identity Parameter + [AmlFilesystemName ]: Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoExportJobName ]: Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [AutoImportJobName ]: Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [Id ]: Resource identity path + [ImportJobName ]: Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [SubscriptionId ]: The ID of the target subscription. +.Link +https://learn.microsoft.com/powershell/module/az.storagecache/update-azstoragecacheimportjob +#> +function Update-AzStorageCacheImportJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the AML file system. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${AmlFilesystemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Alias('ImportJobName')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # Name for the import job. + # Allows alphanumerics, underscores, and hyphens. + # Start and end with alphanumeric. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${AmlFilesystemInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity] + # Identity Parameter + ${InputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # The administrative status of the import job. + # Possible values: 'Active', 'Cancel'. + # Passing in a value of 'Cancel' will cancel the current active import job. + ${AdminStatus}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityAmlFilesystemExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateExpanded'; + UpdateViaIdentityAmlFilesystemExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded'; + UpdateViaIdentityExpanded = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.StorageCache.private\Update-AzStorageCacheImportJob_UpdateViaJsonString'; + } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if ($testPlayback) { + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') + } else { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/generated/StorageCache/StorageCache.Autorest/generate-info.json b/generated/StorageCache/StorageCache.Autorest/generate-info.json index a6bdb9dc5d15..cfc63a3f7003 100644 --- a/generated/StorageCache/StorageCache.Autorest/generate-info.json +++ b/generated/StorageCache/StorageCache.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "b0ebf85c-e595-4abf-a4a3-70b59feaaea4" + "generate_Id": "790ad355-a79a-4e25-8b7e-8bc53b4be55c" } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.PowerShell.cs index daf47597ee16..ec84382cfc55 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.PowerShell.cs @@ -186,6 +186,10 @@ internal AmlFilesystem(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).Hsm = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsm) content.GetValueForProperty("Hsm",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).Hsm, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesHsmTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("StorageCapacityTiB")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).StorageCapacityTiB = (float?) content.GetValueForProperty("StorageCapacityTiB",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).StorageCapacityTiB, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); @@ -250,6 +254,26 @@ internal AmlFilesystem(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).HsmArchiveStatus = (System.Collections.Generic.List) content.GetValueForProperty("HsmArchiveStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).HsmArchiveStatus, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemArchiveTypeConverter.ConvertFrom)); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("ContainerStorageInterfacePersistentVolumeClaim")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).ContainerStorageInterfacePersistentVolumeClaim = (string) content.GetValueForProperty("ContainerStorageInterfacePersistentVolumeClaim",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).ContainerStorageInterfacePersistentVolumeClaim, global::System.Convert.ToString); @@ -282,6 +306,10 @@ internal AmlFilesystem(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } if (content.Contains("SourceVaultId")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SourceVaultId = (string) content.GetValueForProperty("SourceVaultId",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SourceVaultId, global::System.Convert.ToString); @@ -411,6 +439,10 @@ internal AmlFilesystem(global::System.Management.Automation.PSObject content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).Hsm = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsm) content.GetValueForProperty("Hsm",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).Hsm, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesHsmTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("StorageCapacityTiB")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).StorageCapacityTiB = (float?) content.GetValueForProperty("StorageCapacityTiB",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).StorageCapacityTiB, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); @@ -475,6 +507,26 @@ internal AmlFilesystem(global::System.Management.Automation.PSObject content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).HsmArchiveStatus = (System.Collections.Generic.List) content.GetValueForProperty("HsmArchiveStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).HsmArchiveStatus, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemArchiveTypeConverter.ConvertFrom)); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("ContainerStorageInterfacePersistentVolumeClaim")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).ContainerStorageInterfacePersistentVolumeClaim = (string) content.GetValueForProperty("ContainerStorageInterfacePersistentVolumeClaim",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).ContainerStorageInterfacePersistentVolumeClaim, global::System.Convert.ToString); @@ -507,6 +559,10 @@ internal AmlFilesystem(global::System.Management.Automation.PSObject content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } if (content.Contains("SourceVaultId")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SourceVaultId = (string) content.GetValueForProperty("SourceVaultId",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal)this).SourceVaultId, global::System.Convert.ToString); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.cs index be9025157e07..e25d27580ddd 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystem.cs @@ -220,6 +220,12 @@ public partial class AmlFilesystem : /// Internal Acessors for ProvisioningState string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).ProvisioningState = value ?? null; } + /// Internal Acessors for RootSquashSetting + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal.RootSquashSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSetting = value ?? null /* model class */; } + + /// Internal Acessors for RootSquashSettingStatus + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal.RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingStatus = value ?? null; } + /// Internal Acessors for Sku Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISkuName Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SkuName()); set { {_sku = value;} } } @@ -279,6 +285,35 @@ public partial class AmlFilesystem : [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.FormatTable(Index = 2)] public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public string RootSquashSettingMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingMode = value ?? null; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public string RootSquashSettingNoSquashNidList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingNoSquashNidList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingNoSquashNidList = value ?? null; } + + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public long? RootSquashSettingSquashGid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingSquashGid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingSquashGid = value ?? default(long); } + + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public long? RootSquashSettingSquashUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingSquashUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingSquashUid = value ?? default(long); } + + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public string RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).RootSquashSettingStatus; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. @@ -288,12 +323,23 @@ public partial class AmlFilesystem : public string SettingContainer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingContainer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingContainer = value ?? null; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] public string SettingImportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingImportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingImportPrefix = value ?? null; } + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.DoNotFormat] + public System.Collections.Generic.List SettingImportPrefixesInitial { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingImportPrefixesInitial; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)Property).SettingImportPrefixesInitial = value ?? null /* arrayOf */; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the @@ -657,6 +703,66 @@ public partial interface IAmlFilesystem : [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] string ProvisioningState { get; } /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"AML file system squash status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingStatus { get; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. /// @@ -671,7 +777,9 @@ public partial interface IAmlFilesystem : PossibleTypes = new [] { typeof(string) })] string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -679,11 +787,26 @@ public partial interface IAmlFilesystem : Read = true, Create = true, Update = true, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. @@ -837,16 +960,41 @@ internal partial interface IAmlFilesystemInternal : /// ARM provisioning state. [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] string ProvisioningState { get; set; } + /// Specifies root squash settings of the AML file system. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + string RootSquashSettingStatus { get; set; } /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. /// string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.PowerShell.cs index 83ea6eddaa48..2fa2aaff2477 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.PowerShell.cs @@ -88,6 +88,10 @@ internal AmlFilesystemHsmSettings(global::System.Collections.IDictionary content { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefix = (string) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefix, global::System.Convert.ToString); } + if (content.Contains("ImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } AfterDeserializeDictionary(content); } @@ -117,6 +121,10 @@ internal AmlFilesystemHsmSettings(global::System.Management.Automation.PSObject { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefix = (string) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefix, global::System.Convert.ToString); } + if (content.Contains("ImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)this).ImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } AfterDeserializePSObject(content); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.cs index 9dbf1b7bc464..783d062df04f 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.cs @@ -27,11 +27,24 @@ public partial class AmlFilesystemHsmSettings : private string _importPrefix; /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] public string ImportPrefix { get => this._importPrefix; set => this._importPrefix = value; } + /// Backing field for property. + private System.Collections.Generic.List _importPrefixesInitial; + + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List ImportPrefixesInitial { get => this._importPrefixesInitial; set => this._importPrefixesInitial = value; } + /// Backing field for property. private string _loggingContainer; @@ -68,7 +81,9 @@ public partial interface IAmlFilesystemHsmSettings : PossibleTypes = new [] { typeof(string) })] string Container { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -76,11 +91,26 @@ public partial interface IAmlFilesystemHsmSettings : Read = true, Create = true, Update = true, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] string ImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. @@ -107,10 +137,18 @@ internal partial interface IAmlFilesystemHsmSettingsInternal /// string Container { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// string ImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + System.Collections.Generic.List ImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.json.cs index bc00ad3c83f4..54ad20965dc4 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.json.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemHsmSettings.json.cs @@ -68,6 +68,7 @@ internal AmlFilesystemHsmSettings(Microsoft.Azure.PowerShell.Cmdlets.StorageCach {_container = If( json?.PropertyT("container"), out var __jsonContainer) ? (string)__jsonContainer : (string)_container;} {_loggingContainer = If( json?.PropertyT("loggingContainer"), out var __jsonLoggingContainer) ? (string)__jsonLoggingContainer : (string)_loggingContainer;} {_importPrefix = If( json?.PropertyT("importPrefix"), out var __jsonImportPrefix) ? (string)__jsonImportPrefix : (string)_importPrefix;} + {_importPrefixesInitial = If( json?.PropertyT("importPrefixesInitial"), out var __jsonImportPrefixesInitial) ? If( __jsonImportPrefixesInitial as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _importPrefixesInitial;} AfterFromJson(json); } @@ -105,6 +106,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJ AddIf( null != (((object)this._container)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._container.ToString()) : null, "container" ,container.Add ); AddIf( null != (((object)this._loggingContainer)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._loggingContainer.ToString()) : null, "loggingContainer" ,container.Add ); AddIf( null != (((object)this._importPrefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._importPrefix.ToString()) : null, "importPrefix" ,container.Add ); + if (null != this._importPrefixesInitial) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._importPrefixesInitial ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("importPrefixesInitial",__w); + } AfterToJson(ref container); return container; } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.PowerShell.cs index 3b85fc424bef..f4750fbcd560 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.PowerShell.cs @@ -96,6 +96,10 @@ internal AmlFilesystemProperties(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).Hsm = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsm) content.GetValueForProperty("Hsm",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).Hsm, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesHsmTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("StorageCapacityTiB")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).StorageCapacityTiB = (float?) content.GetValueForProperty("StorageCapacityTiB",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).StorageCapacityTiB, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); @@ -160,6 +164,26 @@ internal AmlFilesystemProperties(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).HsmArchiveStatus = (System.Collections.Generic.List) content.GetValueForProperty("HsmArchiveStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).HsmArchiveStatus, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemArchiveTypeConverter.ConvertFrom)); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("ContainerStorageInterfacePersistentVolumeClaim")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).ContainerStorageInterfacePersistentVolumeClaim = (string) content.GetValueForProperty("ContainerStorageInterfacePersistentVolumeClaim",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).ContainerStorageInterfacePersistentVolumeClaim, global::System.Convert.ToString); @@ -192,6 +216,10 @@ internal AmlFilesystemProperties(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } if (content.Contains("SourceVaultId")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SourceVaultId = (string) content.GetValueForProperty("SourceVaultId",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SourceVaultId, global::System.Convert.ToString); @@ -233,6 +261,10 @@ internal AmlFilesystemProperties(global::System.Management.Automation.PSObject c { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).Hsm = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsm) content.GetValueForProperty("Hsm",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).Hsm, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesHsmTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("StorageCapacityTiB")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).StorageCapacityTiB = (float?) content.GetValueForProperty("StorageCapacityTiB",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).StorageCapacityTiB, (__y)=> (float) global::System.Convert.ChangeType(__y, typeof(float))); @@ -297,6 +329,26 @@ internal AmlFilesystemProperties(global::System.Management.Automation.PSObject c { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).HsmArchiveStatus = (System.Collections.Generic.List) content.GetValueForProperty("HsmArchiveStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).HsmArchiveStatus, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemArchiveTypeConverter.ConvertFrom)); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("ContainerStorageInterfacePersistentVolumeClaim")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).ContainerStorageInterfacePersistentVolumeClaim = (string) content.GetValueForProperty("ContainerStorageInterfacePersistentVolumeClaim",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).ContainerStorageInterfacePersistentVolumeClaim, global::System.Convert.ToString); @@ -329,6 +381,10 @@ internal AmlFilesystemProperties(global::System.Management.Automation.PSObject c { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } if (content.Contains("SourceVaultId")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SourceVaultId = (string) content.GetValueForProperty("SourceVaultId",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal)this).SourceVaultId, global::System.Convert.ToString); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.cs index 9865aa3df939..399464e2382f 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.cs @@ -174,6 +174,12 @@ public partial class AmlFilesystemProperties : /// Internal Acessors for ProvisioningState string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + /// Internal Acessors for RootSquashSetting + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal.RootSquashSetting { get => (this._rootSquashSetting = this._rootSquashSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings()); set { {_rootSquashSetting = value;} } } + + /// Internal Acessors for RootSquashSettingStatus + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal.RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status = value ?? null; } + /// Internal Acessors for ThroughputProvisionedMBps int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesInternal.ThroughputProvisionedMBps { get => this._throughputProvisionedMBps; set { {_throughputProvisionedMBps = value;} } } @@ -184,6 +190,37 @@ public partial class AmlFilesystemProperties : [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] public string ProvisioningState { get => this._provisioningState; } + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings _rootSquashSetting; + + /// Specifies root squash settings of the AML file system. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get => (this._rootSquashSetting = this._rootSquashSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings()); set => this._rootSquashSetting = value; } + + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Mode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Mode = value ?? null; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingNoSquashNidList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).NoSquashNidList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).NoSquashNidList = value ?? null; } + + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashGid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashGid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashGid = value ?? default(long); } + + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashUid = value ?? default(long); } + + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. @@ -192,11 +229,21 @@ public partial class AmlFilesystemProperties : public string SettingContainer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingContainer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingContainer = value ?? null; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] public string SettingImportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingImportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingImportPrefix = value ?? null; } + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SettingImportPrefixesInitial { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingImportPrefixesInitial; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)Hsm).SettingImportPrefixesInitial = value ?? null /* arrayOf */; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the @@ -411,6 +458,66 @@ public partial interface IAmlFilesystemProperties : [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] string ProvisioningState { get; } /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"AML file system squash status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingStatus { get; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. /// @@ -425,7 +532,9 @@ public partial interface IAmlFilesystemProperties : PossibleTypes = new [] { typeof(string) })] string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -433,11 +542,26 @@ public partial interface IAmlFilesystemProperties : Read = true, Create = true, Update = true, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. @@ -551,16 +675,41 @@ internal partial interface IAmlFilesystemPropertiesInternal /// ARM provisioning state. [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] string ProvisioningState { get; set; } + /// Specifies root squash settings of the AML file system. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + string RootSquashSettingStatus { get; set; } /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. /// string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.json.cs index faacd0229401..4eef829b3c23 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.json.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemProperties.json.cs @@ -70,6 +70,7 @@ internal AmlFilesystemProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache {_encryptionSetting = If( json?.PropertyT("encryptionSettings"), out var __jsonEncryptionSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemEncryptionSettings.FromJson(__jsonEncryptionSettings) : _encryptionSetting;} {_maintenanceWindow = If( json?.PropertyT("maintenanceWindow"), out var __jsonMaintenanceWindow) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesMaintenanceWindow.FromJson(__jsonMaintenanceWindow) : _maintenanceWindow;} {_hsm = If( json?.PropertyT("hsm"), out var __jsonHsm) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemPropertiesHsm.FromJson(__jsonHsm) : _hsm;} + {_rootSquashSetting = If( json?.PropertyT("rootSquashSettings"), out var __jsonRootSquashSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings.FromJson(__jsonRootSquashSettings) : _rootSquashSetting;} {_storageCapacityTiB = If( json?.PropertyT("storageCapacityTiB"), out var __jsonStorageCapacityTiB) ? (float?)__jsonStorageCapacityTiB : _storageCapacityTiB;} {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} {_filesystemSubnet = If( json?.PropertyT("filesystemSubnet"), out var __jsonFilesystemSubnet) ? (string)__jsonFilesystemSubnet : (string)_filesystemSubnet;} @@ -119,6 +120,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJ AddIf( null != this._encryptionSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._encryptionSetting.ToJson(null,serializationMode) : null, "encryptionSettings" ,container.Add ); AddIf( null != this._maintenanceWindow ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._maintenanceWindow.ToJson(null,serializationMode) : null, "maintenanceWindow" ,container.Add ); AddIf( null != this._hsm ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._hsm.ToJson(null,serializationMode) : null, "hsm" ,container.Add ); + AddIf( null != this._rootSquashSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._rootSquashSetting.ToJson(null,serializationMode) : null, "rootSquashSettings" ,container.Add ); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) { AddIf( null != this._storageCapacityTiB ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((float)this._storageCapacityTiB) : null, "storageCapacityTiB" ,container.Add ); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.PowerShell.cs index da7fd9e2081a..16ad423567af 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.PowerShell.cs @@ -96,6 +96,10 @@ internal AmlFilesystemPropertiesHsm(global::System.Collections.IDictionary conte { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } AfterDeserializeDictionary(content); } @@ -133,6 +137,10 @@ internal AmlFilesystemPropertiesHsm(global::System.Management.Automation.PSObjec { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefix = (string) content.GetValueForProperty("SettingImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefix, global::System.Convert.ToString); } + if (content.Contains("SettingImportPrefixesInitial")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefixesInitial = (System.Collections.Generic.List) content.GetValueForProperty("SettingImportPrefixesInitial",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemPropertiesHsmInternal)this).SettingImportPrefixesInitial, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } AfterDeserializePSObject(content); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.cs index 5edf0c2ed686..d23e9db00024 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemPropertiesHsm.cs @@ -41,11 +41,21 @@ public partial class AmlFilesystemPropertiesHsm : public string SettingContainer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).Container; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).Container = value ?? null; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] public string SettingImportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).ImportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).ImportPrefix = value ?? null; } + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SettingImportPrefixesInitial { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).ImportPrefixesInitial; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemHsmSettingsInternal)Setting).ImportPrefixesInitial = value ?? null /* arrayOf */; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the @@ -90,7 +100,9 @@ public partial interface IAmlFilesystemPropertiesHsm : PossibleTypes = new [] { typeof(string) })] string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -98,11 +110,26 @@ public partial interface IAmlFilesystemPropertiesHsm : Read = true, Create = true, Update = true, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. @@ -133,10 +160,18 @@ internal partial interface IAmlFilesystemPropertiesHsmInternal /// string SettingContainer { get; set; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// string SettingImportPrefix { get; set; } /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + System.Collections.Generic.List SettingImportPrefixesInitial { get; set; } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the /// storage account. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.PowerShell.cs new file mode 100644 index 000000000000..958afa6545e9 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// AML file system squash settings. + [System.ComponentModel.TypeConverter(typeof(AmlFilesystemRootSquashSettingsTypeConverter))] + public partial class AmlFilesystemRootSquashSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AmlFilesystemRootSquashSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Mode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Mode = (string) content.GetValueForProperty("Mode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Mode, global::System.Convert.ToString); + } + if (content.Contains("NoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).NoSquashNidList = (string) content.GetValueForProperty("NoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).NoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("SquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashUid = (long?) content.GetValueForProperty("SquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashGid = (long?) content.GetValueForProperty("SquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Status, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AmlFilesystemRootSquashSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Mode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Mode = (string) content.GetValueForProperty("Mode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Mode, global::System.Convert.ToString); + } + if (content.Contains("NoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).NoSquashNidList = (string) content.GetValueForProperty("NoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).NoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("SquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashUid = (long?) content.GetValueForProperty("SquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashGid = (long?) content.GetValueForProperty("SquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).SquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)this).Status, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AmlFilesystemRootSquashSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AmlFilesystemRootSquashSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// AML file system squash settings. + [System.ComponentModel.TypeConverter(typeof(AmlFilesystemRootSquashSettingsTypeConverter))] + public partial interface IAmlFilesystemRootSquashSettings + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.TypeConverter.cs new file mode 100644 index 000000000000..4345928a967f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AmlFilesystemRootSquashSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AmlFilesystemRootSquashSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AmlFilesystemRootSquashSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AmlFilesystemRootSquashSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.cs new file mode 100644 index 000000000000..979909023994 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// AML file system squash settings. + public partial class AmlFilesystemRootSquashSettings : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal + { + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal.Status { get => this._status; set { {_status = value;} } } + + /// Backing field for property. + private string _mode; + + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Mode { get => this._mode; set => this._mode = value; } + + /// Backing field for property. + private string _noSquashNidList; + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string NoSquashNidList { get => this._noSquashNidList; set => this._noSquashNidList = value; } + + /// Backing field for property. + private long? _squashGid; + + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? SquashGid { get => this._squashGid; set => this._squashGid = value; } + + /// Backing field for property. + private long? _squashUid; + + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? SquashUid { get => this._squashUid; set => this._squashUid = value; } + + /// Backing field for property. + private string _status; + + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Creates an new instance. + public AmlFilesystemRootSquashSettings() + { + + } + } + /// AML file system squash settings. + public partial interface IAmlFilesystemRootSquashSettings : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string Mode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + string NoSquashNidList { get; set; } + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + long? SquashGid { get; set; } + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + long? SquashUid { get; set; } + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"AML file system squash status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; } + + } + /// AML file system squash settings. + internal partial interface IAmlFilesystemRootSquashSettingsInternal + + { + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string Mode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + string NoSquashNidList { get; set; } + /// Group ID to squash to. + long? SquashGid { get; set; } + /// User ID to squash to. + long? SquashUid { get; set; } + /// AML file system squash status. + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.json.cs new file mode 100644 index 000000000000..9f4960bcf9da --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemRootSquashSettings.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// AML file system squash settings. + public partial class AmlFilesystemRootSquashSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AmlFilesystemRootSquashSettings(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_mode = If( json?.PropertyT("mode"), out var __jsonMode) ? (string)__jsonMode : (string)_mode;} + {_noSquashNidList = If( json?.PropertyT("noSquashNidLists"), out var __jsonNoSquashNidLists) ? (string)__jsonNoSquashNidLists : (string)_noSquashNidList;} + {_squashUid = If( json?.PropertyT("squashUID"), out var __jsonSquashUid) ? (long?)__jsonSquashUid : _squashUid;} + {_squashGid = If( json?.PropertyT("squashGID"), out var __jsonSquashGid) ? (long?)__jsonSquashGid : _squashGid;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AmlFilesystemRootSquashSettings(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._mode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._mode.ToString()) : null, "mode" ,container.Add ); + AddIf( null != (((object)this._noSquashNidList)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._noSquashNidList.ToString()) : null, "noSquashNidLists" ,container.Add ); + AddIf( null != this._squashUid ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._squashUid) : null, "squashUID" ,container.Add ); + AddIf( null != this._squashGid ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._squashGid) : null, "squashGID" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.PowerShell.cs index 804b42d4b70f..976de2bae28a 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.PowerShell.cs @@ -92,6 +92,10 @@ internal AmlFilesystemUpdate(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindow = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesMaintenanceWindow) content.GetValueForProperty("MaintenanceWindow",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindow, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindowTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("EncryptionSettingKeyEncryptionKey")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).EncryptionSettingKeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReference) content.GetValueForProperty("EncryptionSettingKeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).EncryptionSettingKeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceTypeConverter.ConvertFrom); @@ -104,6 +108,26 @@ internal AmlFilesystemUpdate(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindowTimeOfDayUtc = (string) content.GetValueForProperty("MaintenanceWindowTimeOfDayUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindowTimeOfDayUtc, global::System.Convert.ToString); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("KeyEncryptionKeySourceVault")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).KeyEncryptionKeySourceVault = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReferenceSourceVault) content.GetValueForProperty("KeyEncryptionKeySourceVault",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).KeyEncryptionKeySourceVault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceSourceVaultTypeConverter.ConvertFrom); @@ -149,6 +173,10 @@ internal AmlFilesystemUpdate(global::System.Management.Automation.PSObject conte { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindow = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesMaintenanceWindow) content.GetValueForProperty("MaintenanceWindow",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindow, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindowTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("EncryptionSettingKeyEncryptionKey")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).EncryptionSettingKeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReference) content.GetValueForProperty("EncryptionSettingKeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).EncryptionSettingKeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceTypeConverter.ConvertFrom); @@ -161,6 +189,26 @@ internal AmlFilesystemUpdate(global::System.Management.Automation.PSObject conte { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindowTimeOfDayUtc = (string) content.GetValueForProperty("MaintenanceWindowTimeOfDayUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).MaintenanceWindowTimeOfDayUtc, global::System.Convert.ToString); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("KeyEncryptionKeySourceVault")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).KeyEncryptionKeySourceVault = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReferenceSourceVault) content.GetValueForProperty("KeyEncryptionKeySourceVault",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal)this).KeyEncryptionKeySourceVault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceSourceVaultTypeConverter.ConvertFrom); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.cs index 8ded8ba9eb61..5060b6315d1d 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdate.cs @@ -40,6 +40,12 @@ public partial class AmlFilesystemUpdate : /// Internal Acessors for Property Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateProperties()); set { {_property = value;} } } + /// Internal Acessors for RootSquashSetting + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal.RootSquashSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSetting = value ?? null /* model class */; } + + /// Internal Acessors for RootSquashSettingStatus + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateInternal.RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingStatus = value ?? null; } + /// Backing field for property. private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateProperties _property; @@ -47,6 +53,30 @@ public partial class AmlFilesystemUpdate : [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdateProperties()); set => this._property = value; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingMode = value ?? null; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingNoSquashNidList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingNoSquashNidList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingNoSquashNidList = value ?? null; } + + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashGid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingSquashGid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingSquashGid = value ?? default(long); } + + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingSquashUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingSquashUid = value ?? default(long); } + + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).RootSquashSettingStatus; } + /// Resource Id. [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] public string SourceVaultId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).SourceVaultId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)Property).SourceVaultId = value ?? null; } @@ -102,6 +132,66 @@ public partial interface IAmlFilesystemUpdate : SerializedName = @"timeOfDayUTC", PossibleTypes = new [] { typeof(string) })] string MaintenanceWindowTimeOfDayUtc { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"AML file system squash status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingStatus { get; } /// Resource Id. [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -147,6 +237,23 @@ internal partial interface IAmlFilesystemUpdateInternal string MaintenanceWindowTimeOfDayUtc { get; set; } /// Properties of the AML file system. Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdateProperties Property { get; set; } + /// Specifies root squash settings of the AML file system. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + string RootSquashSettingStatus { get; set; } /// Resource Id. string SourceVaultId { get; set; } /// Resource tags. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.PowerShell.cs index 43f03018b09d..2ca7968820fa 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.PowerShell.cs @@ -84,6 +84,10 @@ internal AmlFilesystemUpdateProperties(global::System.Collections.IDictionary co { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindow = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesMaintenanceWindow) content.GetValueForProperty("MaintenanceWindow",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindow, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindowTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("EncryptionSettingKeyEncryptionKey")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).EncryptionSettingKeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReference) content.GetValueForProperty("EncryptionSettingKeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).EncryptionSettingKeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceTypeConverter.ConvertFrom); @@ -96,6 +100,26 @@ internal AmlFilesystemUpdateProperties(global::System.Collections.IDictionary co { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindowTimeOfDayUtc = (string) content.GetValueForProperty("MaintenanceWindowTimeOfDayUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindowTimeOfDayUtc, global::System.Convert.ToString); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("KeyEncryptionKeySourceVault")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).KeyEncryptionKeySourceVault = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReferenceSourceVault) content.GetValueForProperty("KeyEncryptionKeySourceVault",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).KeyEncryptionKeySourceVault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceSourceVaultTypeConverter.ConvertFrom); @@ -133,6 +157,10 @@ internal AmlFilesystemUpdateProperties(global::System.Management.Automation.PSOb { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindow = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesMaintenanceWindow) content.GetValueForProperty("MaintenanceWindow",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindow, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindowTypeConverter.ConvertFrom); } + if (content.Contains("RootSquashSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSetting = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings) content.GetValueForProperty("RootSquashSetting",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSetting, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettingsTypeConverter.ConvertFrom); + } if (content.Contains("EncryptionSettingKeyEncryptionKey")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).EncryptionSettingKeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReference) content.GetValueForProperty("EncryptionSettingKeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).EncryptionSettingKeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceTypeConverter.ConvertFrom); @@ -145,6 +173,26 @@ internal AmlFilesystemUpdateProperties(global::System.Management.Automation.PSOb { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindowTimeOfDayUtc = (string) content.GetValueForProperty("MaintenanceWindowTimeOfDayUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).MaintenanceWindowTimeOfDayUtc, global::System.Convert.ToString); } + if (content.Contains("RootSquashSettingMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingMode = (string) content.GetValueForProperty("RootSquashSettingMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingMode, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingNoSquashNidList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingNoSquashNidList = (string) content.GetValueForProperty("RootSquashSettingNoSquashNidList",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingNoSquashNidList, global::System.Convert.ToString); + } + if (content.Contains("RootSquashSettingSquashUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashUid = (long?) content.GetValueForProperty("RootSquashSettingSquashUid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashUid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingSquashGid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashGid = (long?) content.GetValueForProperty("RootSquashSettingSquashGid",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingSquashGid, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RootSquashSettingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingStatus = (string) content.GetValueForProperty("RootSquashSettingStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).RootSquashSettingStatus, global::System.Convert.ToString); + } if (content.Contains("KeyEncryptionKeySourceVault")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).KeyEncryptionKeySourceVault = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IKeyVaultKeyReferenceSourceVault) content.GetValueForProperty("KeyEncryptionKeySourceVault",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal)this).KeyEncryptionKeySourceVault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.KeyVaultKeyReferenceSourceVaultTypeConverter.ConvertFrom); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.cs index 31288a05471b..755644ee7bd8 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.cs @@ -51,6 +51,43 @@ public partial class AmlFilesystemUpdateProperties : /// Internal Acessors for MaintenanceWindow Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesMaintenanceWindow Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal.MaintenanceWindow { get => (this._maintenanceWindow = this._maintenanceWindow ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow()); set { {_maintenanceWindow = value;} } } + /// Internal Acessors for RootSquashSetting + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal.RootSquashSetting { get => (this._rootSquashSetting = this._rootSquashSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings()); set { {_rootSquashSetting = value;} } } + + /// Internal Acessors for RootSquashSettingStatus + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdatePropertiesInternal.RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings _rootSquashSetting; + + /// Specifies root squash settings of the AML file system. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get => (this._rootSquashSetting = this._rootSquashSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings()); set => this._rootSquashSetting = value; } + + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Mode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Mode = value ?? null; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingNoSquashNidList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).NoSquashNidList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).NoSquashNidList = value ?? null; } + + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashGid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashGid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashGid = value ?? default(long); } + + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? RootSquashSettingSquashUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).SquashUid = value ?? default(long); } + + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string RootSquashSettingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettingsInternal)RootSquashSetting).Status; } + /// Resource Id. [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] public string SourceVaultId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemEncryptionSettingsInternal)EncryptionSetting).SourceVaultId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemEncryptionSettingsInternal)EncryptionSetting).SourceVaultId = value ?? null; } @@ -99,6 +136,66 @@ public partial interface IAmlFilesystemUpdateProperties : SerializedName = @"timeOfDayUTC", PossibleTypes = new [] { typeof(string) })] string MaintenanceWindowTimeOfDayUtc { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"AML file system squash status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string RootSquashSettingStatus { get; } /// Resource Id. [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -131,6 +228,23 @@ internal partial interface IAmlFilesystemUpdatePropertiesInternal string MaintenanceWindowDayOfWeek { get; set; } /// The time of day (in UTC) to start the maintenance window. string MaintenanceWindowTimeOfDayUtc { get; set; } + /// Specifies root squash settings of the AML file system. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemRootSquashSettings RootSquashSetting { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + string RootSquashSettingMode { get; set; } + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + string RootSquashSettingNoSquashNidList { get; set; } + /// Group ID to squash to. + long? RootSquashSettingSquashGid { get; set; } + /// User ID to squash to. + long? RootSquashSettingSquashUid { get; set; } + /// AML file system squash status. + string RootSquashSettingStatus { get; set; } /// Resource Id. string SourceVaultId { get; set; } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.json.cs index 775a8f2eba0e..93a6f5fbdc03 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.json.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AmlFilesystemUpdateProperties.json.cs @@ -67,6 +67,7 @@ internal AmlFilesystemUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.Storag } {_encryptionSetting = If( json?.PropertyT("encryptionSettings"), out var __jsonEncryptionSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemEncryptionSettings.FromJson(__jsonEncryptionSettings) : _encryptionSetting;} {_maintenanceWindow = If( json?.PropertyT("maintenanceWindow"), out var __jsonMaintenanceWindow) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemUpdatePropertiesMaintenanceWindow.FromJson(__jsonMaintenanceWindow) : _maintenanceWindow;} + {_rootSquashSetting = If( json?.PropertyT("rootSquashSettings"), out var __jsonRootSquashSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AmlFilesystemRootSquashSettings.FromJson(__jsonRootSquashSettings) : _rootSquashSetting;} AfterFromJson(json); } @@ -103,6 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJ } AddIf( null != this._encryptionSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._encryptionSetting.ToJson(null,serializationMode) : null, "encryptionSettings" ,container.Add ); AddIf( null != this._maintenanceWindow ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._maintenanceWindow.ToJson(null,serializationMode) : null, "maintenanceWindow" ,container.Add ); + AddIf( null != this._rootSquashSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._rootSquashSetting.ToJson(null,serializationMode) : null, "rootSquashSettings" ,container.Add ); AfterToJson(ref container); return container; } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.PowerShell.cs new file mode 100644 index 000000000000..be0ba368d9ac --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial class Any + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Any(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Any(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Any(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Any(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial interface IAny + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.TypeConverter.cs new file mode 100644 index 000000000000..88ba9cd83c81 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Any.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Any.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Any.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.cs new file mode 100644 index 000000000000..e15bc83cb4a3 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Anything + public partial class Any : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAnyInternal + { + + /// Creates an new instance. + public Any() + { + + } + } + /// Anything + public partial interface IAny : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + + } + /// Anything + internal partial interface IAnyInternal + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.json.cs new file mode 100644 index 000000000000..22b3535a13dc --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/Any.json.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Anything + public partial class Any + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal Any(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new Any(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.PowerShell.cs new file mode 100644 index 000000000000..0a8a1dcb87ad --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.PowerShell.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + [System.ComponentModel.TypeConverter(typeof(AutoExportJobTypeConverter))] + public partial class AutoExportJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJob(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoExportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AutoExportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoExportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AutoExportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesExported = (long?) content.GetValueForProperty("StatusTotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalMiBExported = (long?) content.GetValueForProperty("StatusTotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesFailed = (long?) content.GetValueForProperty("StatusTotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusExportIterationCount = (int?) content.GetValueForProperty("StatusExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusLastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusCurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesExported = (long?) content.GetValueForProperty("StatusCurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBExported = (long?) content.GetValueForProperty("StatusCurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesFailed = (long?) content.GetValueForProperty("StatusCurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJob(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoExportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AutoExportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoExportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AutoExportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesExported = (long?) content.GetValueForProperty("StatusTotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalMiBExported = (long?) content.GetValueForProperty("StatusTotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesFailed = (long?) content.GetValueForProperty("StatusTotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusTotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusExportIterationCount = (int?) content.GetValueForProperty("StatusExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusLastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusCurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesExported = (long?) content.GetValueForProperty("StatusCurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBExported = (long?) content.GetValueForProperty("StatusCurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesFailed = (long?) content.GetValueForProperty("StatusCurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusCurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).StatusLastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJob(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + [System.ComponentModel.TypeConverter(typeof(AutoExportJobTypeConverter))] + public partial interface IAutoExportJob + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.TypeConverter.cs new file mode 100644 index 000000000000..7074934706b6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.cs new file mode 100644 index 000000000000..b8edfb1db84b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class AutoExportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IValidates, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).AdminStatus = value ?? null; } + + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AutoExportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).AutoExportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).AutoExportPrefix = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).Status = value ?? null /* model class */; } + + /// Internal Acessors for StatusCode + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCode = value ?? null; } + + /// Internal Acessors for StatusCurrentIterationFilesDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCurrentIterationFilesDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesDiscovered; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesDiscovered = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCurrentIterationFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesExported = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCurrentIterationFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesFailed; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesFailed = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationMiBDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCurrentIterationMiBDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBDiscovered; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBDiscovered = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusCurrentIterationMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBExported = value ?? default(long); } + + /// Internal Acessors for StatusExportIterationCount + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusExportIterationCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusExportIterationCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusExportIterationCount = value ?? default(int); } + + /// Internal Acessors for StatusLastCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusLastCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastCompletionTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastCompletionTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastStartedTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusLastStartedTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastStartedTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastStartedTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastSuccessfulIterationCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusLastSuccessfulIterationCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastSuccessfulIterationCompletionTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastSuccessfulIterationCompletionTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusMessage = value ?? null; } + + /// Internal Acessors for StatusState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusState = value ?? null; } + + /// Internal Acessors for StatusTotalFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusTotalFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesExported = value ?? default(long); } + + /// Internal Acessors for StatusTotalFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusTotalFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesFailed; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesFailed = value ?? default(long); } + + /// Internal Acessors for StatusTotalMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal.StatusTotalMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalMiBExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalMiBExported = value ?? default(long); } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name = value ?? null; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties _property; + + /// Properties of the auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobProperties()); set => this._property = value; } + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCode; } + + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesDiscovered; } + + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesExported; } + + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationFilesFailed; } + + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationMiBDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBDiscovered; } + + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusCurrentIterationMiBExported; } + + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusExportIterationCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusExportIterationCount; } + + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastCompletionTimeUtc; } + + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastStartedTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastStartedTimeUtc; } + + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusLastSuccessfulIterationCompletionTimeUtc; } + + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusMessage; } + + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusState; } + + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesExported; } + + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalFilesFailed; } + + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)Property).StatusTotalMiBExported; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public AutoExportJob() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + public partial interface IAutoExportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.", + SerializedName = @"autoExportPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AutoExportPrefix { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status code for auto export job.", + SerializedName = @"statusCode", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; } + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationFilesDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesDiscovered { get; } + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that have been exported in current iteration.", + SerializedName = @"currentIterationFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesExported { get; } + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files failed to export in current iteration.", + SerializedName = @"currentIterationFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesFailed { get; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationMiBDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationMiBDiscovered { get; } + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) that have been exported in current iteration.", + SerializedName = @"currentIterationMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationMiBExported { get; } + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of iterations completed since the start of the export.", + SerializedName = @"exportIterationCount", + PossibleTypes = new [] { typeof(int) })] + int? StatusExportIterationCount { get; } + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed auto export job.", + SerializedName = @"lastCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastCompletionTimeUtc { get; } + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest auto export job started.", + SerializedName = @"lastStartedTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastStartedTimeUtc { get; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time (in UTC) of the last successfully completed export iteration. Look at logging container for details.", + SerializedName = @"lastSuccessfulIterationCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get; } + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status message for auto export job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string StatusState { get; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalFilesExported { get; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalFilesFailed { get; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalMiBExported { get; } + + } + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + internal partial interface IAutoExportJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + System.Collections.Generic.List AutoExportPrefix { get; set; } + + string AzureAsyncOperation { get; set; } + /// Properties of the auto export job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties Property { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the auto export + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus Status { get; set; } + /// Server-defined status code for auto export job. + string StatusCode { get; set; } + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + long? StatusCurrentIterationFilesDiscovered { get; set; } + /// Files that have been exported in current iteration. + long? StatusCurrentIterationFilesExported { get; set; } + /// Files failed to export in current iteration. + long? StatusCurrentIterationFilesFailed { get; set; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + long? StatusCurrentIterationMiBDiscovered { get; set; } + /// Data (in MiB) that have been exported in current iteration. + long? StatusCurrentIterationMiBExported { get; set; } + /// Number of iterations completed since the start of the export. + int? StatusExportIterationCount { get; set; } + /// The time (in UTC) of the last completed auto export job. + global::System.DateTime? StatusLastCompletionTimeUtc { get; set; } + /// The time (in UTC) the latest auto export job started. + global::System.DateTime? StatusLastStartedTimeUtc { get; set; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get; set; } + /// Server-defined status message for auto export job. + string StatusMessage { get; set; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string StatusState { get; set; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? StatusTotalFilesExported { get; set; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + long? StatusTotalFilesFailed { get; set; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? StatusTotalMiBExported { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.json.cs new file mode 100644 index 000000000000..9c3b03d9fa65 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJob.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class AutoExportJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJob(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJob(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.PowerShell.cs new file mode 100644 index 000000000000..4cd681c22c6f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.PowerShell.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Properties of the auto export job. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobPropertiesTypeConverter))] + public partial class AutoExportJobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoExportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AutoExportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoExportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AutoExportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesExported = (long?) content.GetValueForProperty("StatusTotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalMiBExported = (long?) content.GetValueForProperty("StatusTotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesFailed = (long?) content.GetValueForProperty("StatusTotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusExportIterationCount = (int?) content.GetValueForProperty("StatusExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusLastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusCurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesExported = (long?) content.GetValueForProperty("StatusCurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBExported = (long?) content.GetValueForProperty("StatusCurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesFailed = (long?) content.GetValueForProperty("StatusCurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoExportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AutoExportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoExportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).AutoExportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesExported = (long?) content.GetValueForProperty("StatusTotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalMiBExported = (long?) content.GetValueForProperty("StatusTotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesFailed = (long?) content.GetValueForProperty("StatusTotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusTotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusExportIterationCount = (int?) content.GetValueForProperty("StatusExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusLastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusCurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("StatusCurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesExported = (long?) content.GetValueForProperty("StatusCurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBExported = (long?) content.GetValueForProperty("StatusCurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusCurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesFailed = (long?) content.GetValueForProperty("StatusCurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusCurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal)this).StatusLastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Properties of the auto export job. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobPropertiesTypeConverter))] + public partial interface IAutoExportJobProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.TypeConverter.cs new file mode 100644 index 000000000000..f8eb8b347894 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.cs new file mode 100644 index 000000000000..5811dc9e4272 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.cs @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the auto export job. + public partial class AutoExportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Backing field for property. + private System.Collections.Generic.List _autoExportPrefix; + + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List AutoExportPrefix { get => this._autoExportPrefix; set => this._autoExportPrefix = value; } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusCode + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusCode = value ?? null; } + + /// Internal Acessors for StatusCurrentIterationFilesDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCurrentIterationFilesDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesDiscovered; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesDiscovered = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCurrentIterationFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesExported = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCurrentIterationFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesFailed; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesFailed = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationMiBDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCurrentIterationMiBDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBDiscovered; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBDiscovered = value ?? default(long); } + + /// Internal Acessors for StatusCurrentIterationMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusCurrentIterationMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBExported = value ?? default(long); } + + /// Internal Acessors for StatusExportIterationCount + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusExportIterationCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).ExportIterationCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).ExportIterationCount = value ?? default(int); } + + /// Internal Acessors for StatusLastCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusLastCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastCompletionTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastCompletionTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastStartedTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusLastStartedTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastStartedTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastStartedTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastSuccessfulIterationCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusLastSuccessfulIterationCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastSuccessfulIterationCompletionTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastSuccessfulIterationCompletionTimeUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusMessage = value ?? null; } + + /// Internal Acessors for StatusState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).State = value ?? null; } + + /// Internal Acessors for StatusTotalFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusTotalFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesExported = value ?? default(long); } + + /// Internal Acessors for StatusTotalFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusTotalFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesFailed; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesFailed = value ?? default(long); } + + /// Internal Acessors for StatusTotalMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesInternal.StatusTotalMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalMiBExported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalMiBExported = value ?? default(long); } + + /// Backing field for property. + private string _provisioningState; + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus _status; + + /// The status of the auto export + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatus()); } + + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusCode; } + + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesDiscovered; } + + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesExported; } + + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationFilesFailed; } + + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationMiBDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBDiscovered; } + + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusCurrentIterationMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).CurrentIterationMiBExported; } + + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusExportIterationCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).ExportIterationCount; } + + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastCompletionTimeUtc; } + + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastStartedTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastStartedTimeUtc; } + + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).LastSuccessfulIterationCompletionTimeUtc; } + + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).StatusMessage; } + + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).State; } + + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalFilesExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesExported; } + + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalFilesFailed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalFilesFailed; } + + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalMiBExported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)Status).TotalMiBExported; } + + /// Creates an new instance. + public AutoExportJobProperties() + { + + } + } + /// Properties of the auto export job. + public partial interface IAutoExportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.", + SerializedName = @"autoExportPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AutoExportPrefix { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status code for auto export job.", + SerializedName = @"statusCode", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; } + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationFilesDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesDiscovered { get; } + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that have been exported in current iteration.", + SerializedName = @"currentIterationFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesExported { get; } + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files failed to export in current iteration.", + SerializedName = @"currentIterationFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationFilesFailed { get; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationMiBDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationMiBDiscovered { get; } + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) that have been exported in current iteration.", + SerializedName = @"currentIterationMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusCurrentIterationMiBExported { get; } + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of iterations completed since the start of the export.", + SerializedName = @"exportIterationCount", + PossibleTypes = new [] { typeof(int) })] + int? StatusExportIterationCount { get; } + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed auto export job.", + SerializedName = @"lastCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastCompletionTimeUtc { get; } + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest auto export job started.", + SerializedName = @"lastStartedTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastStartedTimeUtc { get; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time (in UTC) of the last successfully completed export iteration. Look at logging container for details.", + SerializedName = @"lastSuccessfulIterationCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get; } + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status message for auto export job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string StatusState { get; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalFilesExported { get; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalFilesFailed { get; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalMiBExported { get; } + + } + /// Properties of the auto export job. + internal partial interface IAutoExportJobPropertiesInternal + + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + System.Collections.Generic.List AutoExportPrefix { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the auto export + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus Status { get; set; } + /// Server-defined status code for auto export job. + string StatusCode { get; set; } + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + long? StatusCurrentIterationFilesDiscovered { get; set; } + /// Files that have been exported in current iteration. + long? StatusCurrentIterationFilesExported { get; set; } + /// Files failed to export in current iteration. + long? StatusCurrentIterationFilesFailed { get; set; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + long? StatusCurrentIterationMiBDiscovered { get; set; } + /// Data (in MiB) that have been exported in current iteration. + long? StatusCurrentIterationMiBExported { get; set; } + /// Number of iterations completed since the start of the export. + int? StatusExportIterationCount { get; set; } + /// The time (in UTC) of the last completed auto export job. + global::System.DateTime? StatusLastCompletionTimeUtc { get; set; } + /// The time (in UTC) the latest auto export job started. + global::System.DateTime? StatusLastStartedTimeUtc { get; set; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + global::System.DateTime? StatusLastSuccessfulIterationCompletionTimeUtc { get; set; } + /// Server-defined status message for auto export job. + string StatusMessage { get; set; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string StatusState { get; set; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? StatusTotalFilesExported { get; set; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + long? StatusTotalFilesFailed { get; set; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? StatusTotalMiBExported { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.json.cs new file mode 100644 index 000000000000..f0808ed4f507 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobProperties.json.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the auto export job. + public partial class AutoExportJobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobPropertiesStatus.FromJson(__jsonStatus) : _status;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + {_autoExportPrefix = If( json?.PropertyT("autoExportPrefixes"), out var __jsonAutoExportPrefixes) ? If( __jsonAutoExportPrefixes as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _autoExportPrefix;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + if (null != this._autoExportPrefix) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._autoExportPrefix ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("autoExportPrefixes",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.PowerShell.cs new file mode 100644 index 000000000000..25fef6d47500 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.PowerShell.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The status of the auto export + [System.ComponentModel.TypeConverter(typeof(AutoExportJobPropertiesStatusTypeConverter))] + public partial class AutoExportJobPropertiesStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobPropertiesStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("TotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesExported = (long?) content.GetValueForProperty("TotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalMiBExported = (long?) content.GetValueForProperty("TotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesFailed = (long?) content.GetValueForProperty("TotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).ExportIterationCount = (int?) content.GetValueForProperty("ExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).ExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("CurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("CurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesExported = (long?) content.GetValueForProperty("CurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBExported = (long?) content.GetValueForProperty("CurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesFailed = (long?) content.GetValueForProperty("CurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobPropertiesStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("TotalFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesExported = (long?) content.GetValueForProperty("TotalFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalMiBExported = (long?) content.GetValueForProperty("TotalMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesFailed = (long?) content.GetValueForProperty("TotalFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).TotalFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ExportIterationCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).ExportIterationCount = (int?) content.GetValueForProperty("ExportIterationCount",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).ExportIterationCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LastSuccessfulIterationCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastSuccessfulIterationCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulIterationCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastSuccessfulIterationCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentIterationFilesDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesDiscovered = (long?) content.GetValueForProperty("CurrentIterationFilesDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationMiBDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBDiscovered = (long?) content.GetValueForProperty("CurrentIterationMiBDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBDiscovered, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationFilesExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesExported = (long?) content.GetValueForProperty("CurrentIterationFilesExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationMiBExported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBExported = (long?) content.GetValueForProperty("CurrentIterationMiBExported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationMiBExported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CurrentIterationFilesFailed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesFailed = (long?) content.GetValueForProperty("CurrentIterationFilesFailed",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).CurrentIterationFilesFailed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal)this).LastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobPropertiesStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobPropertiesStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The status of the auto export + [System.ComponentModel.TypeConverter(typeof(AutoExportJobPropertiesStatusTypeConverter))] + public partial interface IAutoExportJobPropertiesStatus + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.TypeConverter.cs new file mode 100644 index 000000000000..044aa08f1b2b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobPropertiesStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobPropertiesStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobPropertiesStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobPropertiesStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.cs new file mode 100644 index 000000000000..25a2820e23bd --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.cs @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the auto export + public partial class AutoExportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal + { + + /// Backing field for property. + private long? _currentIterationFilesDiscovered; + + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? CurrentIterationFilesDiscovered { get => this._currentIterationFilesDiscovered; } + + /// Backing field for property. + private long? _currentIterationFilesExported; + + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? CurrentIterationFilesExported { get => this._currentIterationFilesExported; } + + /// Backing field for property. + private long? _currentIterationFilesFailed; + + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? CurrentIterationFilesFailed { get => this._currentIterationFilesFailed; } + + /// Backing field for property. + private long? _currentIterationMiBDiscovered; + + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? CurrentIterationMiBDiscovered { get => this._currentIterationMiBDiscovered; } + + /// Backing field for property. + private long? _currentIterationMiBExported; + + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? CurrentIterationMiBExported { get => this._currentIterationMiBExported; } + + /// Backing field for property. + private int? _exportIterationCount; + + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public int? ExportIterationCount { get => this._exportIterationCount; } + + /// Backing field for property. + private global::System.DateTime? _lastCompletionTimeUtc; + + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastCompletionTimeUtc { get => this._lastCompletionTimeUtc; } + + /// Backing field for property. + private global::System.DateTime? _lastStartedTimeUtc; + + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastStartedTimeUtc { get => this._lastStartedTimeUtc; } + + /// + /// Backing field for property. + /// + private global::System.DateTime? _lastSuccessfulIterationCompletionTimeUtc; + + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulIterationCompletionTimeUtc { get => this._lastSuccessfulIterationCompletionTimeUtc; } + + /// Internal Acessors for CurrentIterationFilesDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.CurrentIterationFilesDiscovered { get => this._currentIterationFilesDiscovered; set { {_currentIterationFilesDiscovered = value;} } } + + /// Internal Acessors for CurrentIterationFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.CurrentIterationFilesExported { get => this._currentIterationFilesExported; set { {_currentIterationFilesExported = value;} } } + + /// Internal Acessors for CurrentIterationFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.CurrentIterationFilesFailed { get => this._currentIterationFilesFailed; set { {_currentIterationFilesFailed = value;} } } + + /// Internal Acessors for CurrentIterationMiBDiscovered + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.CurrentIterationMiBDiscovered { get => this._currentIterationMiBDiscovered; set { {_currentIterationMiBDiscovered = value;} } } + + /// Internal Acessors for CurrentIterationMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.CurrentIterationMiBExported { get => this._currentIterationMiBExported; set { {_currentIterationMiBExported = value;} } } + + /// Internal Acessors for ExportIterationCount + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.ExportIterationCount { get => this._exportIterationCount; set { {_exportIterationCount = value;} } } + + /// Internal Acessors for LastCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.LastCompletionTimeUtc { get => this._lastCompletionTimeUtc; set { {_lastCompletionTimeUtc = value;} } } + + /// Internal Acessors for LastStartedTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.LastStartedTimeUtc { get => this._lastStartedTimeUtc; set { {_lastStartedTimeUtc = value;} } } + + /// Internal Acessors for LastSuccessfulIterationCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.LastSuccessfulIterationCompletionTimeUtc { get => this._lastSuccessfulIterationCompletionTimeUtc; set { {_lastSuccessfulIterationCompletionTimeUtc = value;} } } + + /// Internal Acessors for StatusCode + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.StatusCode { get => this._statusCode; set { {_statusCode = value;} } } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.StatusMessage { get => this._statusMessage; set { {_statusMessage = value;} } } + + /// Internal Acessors for TotalFilesExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.TotalFilesExported { get => this._totalFilesExported; set { {_totalFilesExported = value;} } } + + /// Internal Acessors for TotalFilesFailed + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.TotalFilesFailed { get => this._totalFilesFailed; set { {_totalFilesFailed = value;} } } + + /// Internal Acessors for TotalMiBExported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatusInternal.TotalMiBExported { get => this._totalMiBExported; set { {_totalMiBExported = value;} } } + + /// Backing field for property. + private string _state; + + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _statusCode; + + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string StatusCode { get => this._statusCode; } + + /// Backing field for property. + private string _statusMessage; + + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string StatusMessage { get => this._statusMessage; } + + /// Backing field for property. + private long? _totalFilesExported; + + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalFilesExported { get => this._totalFilesExported; } + + /// Backing field for property. + private long? _totalFilesFailed; + + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalFilesFailed { get => this._totalFilesFailed; } + + /// Backing field for property. + private long? _totalMiBExported; + + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalMiBExported { get => this._totalMiBExported; } + + /// Creates an new instance. + public AutoExportJobPropertiesStatus() + { + + } + } + /// The status of the auto export + public partial interface IAutoExportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationFilesDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? CurrentIterationFilesDiscovered { get; } + /// Files that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that have been exported in current iteration.", + SerializedName = @"currentIterationFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? CurrentIterationFilesExported { get; } + /// Files failed to export in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files failed to export in current iteration.", + SerializedName = @"currentIterationFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? CurrentIterationFilesFailed { get; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) discovered for export in current iteration. It may increase while more export items are found.", + SerializedName = @"currentIterationMiBDiscovered", + PossibleTypes = new [] { typeof(long) })] + long? CurrentIterationMiBDiscovered { get; } + /// Data (in MiB) that have been exported in current iteration. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data (in MiB) that have been exported in current iteration.", + SerializedName = @"currentIterationMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? CurrentIterationMiBExported { get; } + /// Number of iterations completed since the start of the export. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of iterations completed since the start of the export.", + SerializedName = @"exportIterationCount", + PossibleTypes = new [] { typeof(int) })] + int? ExportIterationCount { get; } + /// The time (in UTC) of the last completed auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed auto export job.", + SerializedName = @"lastCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastCompletionTimeUtc { get; } + /// The time (in UTC) the latest auto export job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest auto export job started.", + SerializedName = @"lastStartedTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStartedTimeUtc { get; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time (in UTC) of the last successfully completed export iteration. Look at logging container for details.", + SerializedName = @"lastSuccessfulIterationCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulIterationCompletionTimeUtc { get; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string State { get; set; } + /// Server-defined status code for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status code for auto export job.", + SerializedName = @"statusCode", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; } + /// Server-defined status message for auto export job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status message for auto export job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesExported", + PossibleTypes = new [] { typeof(long) })] + long? TotalFilesExported { get; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalFilesFailed", + PossibleTypes = new [] { typeof(long) })] + long? TotalFilesFailed { get; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly.", + SerializedName = @"totalMiBExported", + PossibleTypes = new [] { typeof(long) })] + long? TotalMiBExported { get; } + + } + /// The status of the auto export + internal partial interface IAutoExportJobPropertiesStatusInternal + + { + /// + /// Files discovered for export in current iteration. It may increase while more export items are found. + /// + long? CurrentIterationFilesDiscovered { get; set; } + /// Files that have been exported in current iteration. + long? CurrentIterationFilesExported { get; set; } + /// Files failed to export in current iteration. + long? CurrentIterationFilesFailed { get; set; } + /// + /// Data (in MiB) discovered for export in current iteration. It may increase while more export items are found. + /// + long? CurrentIterationMiBDiscovered { get; set; } + /// Data (in MiB) that have been exported in current iteration. + long? CurrentIterationMiBExported { get; set; } + /// Number of iterations completed since the start of the export. + int? ExportIterationCount { get; set; } + /// The time (in UTC) of the last completed auto export job. + global::System.DateTime? LastCompletionTimeUtc { get; set; } + /// The time (in UTC) the latest auto export job started. + global::System.DateTime? LastStartedTimeUtc { get; set; } + /// + /// Time (in UTC) of the last successfully completed export iteration. Look at logging container for details. + /// + global::System.DateTime? LastSuccessfulIterationCompletionTimeUtc { get; set; } + /// + /// The operational state of auto export. InProgress indicates the export is running. Disabling indicates the user has requested + /// to disable the export but the disabling is still in progress. Disabled indicates auto export has been disabled. DisableFailed + /// indicates the disabling has failed. Failed means the export was unable to continue, due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Disabling", "Disabled", "DisableFailed", "Failed")] + string State { get; set; } + /// Server-defined status code for auto export job. + string StatusCode { get; set; } + /// Server-defined status message for auto export job. + string StatusMessage { get; set; } + /// + /// Total files exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? TotalFilesExported { get; set; } + /// + /// Total files failed to be export since the last successfully completed iteration. This is accumulative, some files may + /// be counted repeatedly. + /// + long? TotalFilesFailed { get; set; } + /// + /// Total data (in MiB) exported since the start of the export. This is accumulative, some files may be counted repeatedly. + /// + long? TotalMiBExported { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.json.cs new file mode 100644 index 000000000000..3043ef31e0de --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobPropertiesStatus.json.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the auto export + public partial class AutoExportJobPropertiesStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobPropertiesStatus(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + {_statusCode = If( json?.PropertyT("statusCode"), out var __jsonStatusCode) ? (string)__jsonStatusCode : (string)_statusCode;} + {_statusMessage = If( json?.PropertyT("statusMessage"), out var __jsonStatusMessage) ? (string)__jsonStatusMessage : (string)_statusMessage;} + {_totalFilesExported = If( json?.PropertyT("totalFilesExported"), out var __jsonTotalFilesExported) ? (long?)__jsonTotalFilesExported : _totalFilesExported;} + {_totalMiBExported = If( json?.PropertyT("totalMiBExported"), out var __jsonTotalMiBExported) ? (long?)__jsonTotalMiBExported : _totalMiBExported;} + {_totalFilesFailed = If( json?.PropertyT("totalFilesFailed"), out var __jsonTotalFilesFailed) ? (long?)__jsonTotalFilesFailed : _totalFilesFailed;} + {_exportIterationCount = If( json?.PropertyT("exportIterationCount"), out var __jsonExportIterationCount) ? (int?)__jsonExportIterationCount : _exportIterationCount;} + {_lastSuccessfulIterationCompletionTimeUtc = If( json?.PropertyT("lastSuccessfulIterationCompletionTimeUTC"), out var __jsonLastSuccessfulIterationCompletionTimeUtc) ? global::System.DateTime.TryParse((string)__jsonLastSuccessfulIterationCompletionTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSuccessfulIterationCompletionTimeUtcValue) ? __jsonLastSuccessfulIterationCompletionTimeUtcValue : _lastSuccessfulIterationCompletionTimeUtc : _lastSuccessfulIterationCompletionTimeUtc;} + {_currentIterationFilesDiscovered = If( json?.PropertyT("currentIterationFilesDiscovered"), out var __jsonCurrentIterationFilesDiscovered) ? (long?)__jsonCurrentIterationFilesDiscovered : _currentIterationFilesDiscovered;} + {_currentIterationMiBDiscovered = If( json?.PropertyT("currentIterationMiBDiscovered"), out var __jsonCurrentIterationMiBDiscovered) ? (long?)__jsonCurrentIterationMiBDiscovered : _currentIterationMiBDiscovered;} + {_currentIterationFilesExported = If( json?.PropertyT("currentIterationFilesExported"), out var __jsonCurrentIterationFilesExported) ? (long?)__jsonCurrentIterationFilesExported : _currentIterationFilesExported;} + {_currentIterationMiBExported = If( json?.PropertyT("currentIterationMiBExported"), out var __jsonCurrentIterationMiBExported) ? (long?)__jsonCurrentIterationMiBExported : _currentIterationMiBExported;} + {_currentIterationFilesFailed = If( json?.PropertyT("currentIterationFilesFailed"), out var __jsonCurrentIterationFilesFailed) ? (long?)__jsonCurrentIterationFilesFailed : _currentIterationFilesFailed;} + {_lastStartedTimeUtc = If( json?.PropertyT("lastStartedTimeUTC"), out var __jsonLastStartedTimeUtc) ? global::System.DateTime.TryParse((string)__jsonLastStartedTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastStartedTimeUtcValue) ? __jsonLastStartedTimeUtcValue : _lastStartedTimeUtc : _lastStartedTimeUtc;} + {_lastCompletionTimeUtc = If( json?.PropertyT("lastCompletionTimeUTC"), out var __jsonLastCompletionTimeUtc) ? global::System.DateTime.TryParse((string)__jsonLastCompletionTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastCompletionTimeUtcValue) ? __jsonLastCompletionTimeUtcValue : _lastCompletionTimeUtc : _lastCompletionTimeUtc;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobPropertiesStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobPropertiesStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._statusCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._statusCode.ToString()) : null, "statusCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._statusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._statusMessage.ToString()) : null, "statusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalFilesExported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalFilesExported) : null, "totalFilesExported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalMiBExported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalMiBExported) : null, "totalMiBExported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalFilesFailed ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalFilesFailed) : null, "totalFilesFailed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._exportIterationCount ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((int)this._exportIterationCount) : null, "exportIterationCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastSuccessfulIterationCompletionTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastSuccessfulIterationCompletionTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulIterationCompletionTimeUTC" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._currentIterationFilesDiscovered ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._currentIterationFilesDiscovered) : null, "currentIterationFilesDiscovered" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._currentIterationMiBDiscovered ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._currentIterationMiBDiscovered) : null, "currentIterationMiBDiscovered" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._currentIterationFilesExported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._currentIterationFilesExported) : null, "currentIterationFilesExported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._currentIterationMiBExported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._currentIterationMiBExported) : null, "currentIterationMiBExported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._currentIterationFilesFailed ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._currentIterationFilesFailed) : null, "currentIterationFilesFailed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastStartedTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastStartedTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastStartedTimeUTC" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastCompletionTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastCompletionTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastCompletionTimeUTC" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.PowerShell.cs new file mode 100644 index 000000000000..afab35c1005c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// An auto export job update instance. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdateTypeConverter))] + public partial class AutoExportJobUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An auto export job update instance. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdateTypeConverter))] + public partial interface IAutoExportJobUpdate + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.TypeConverter.cs new file mode 100644 index 000000000000..1c6c67a8cc87 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.cs new file mode 100644 index 000000000000..1d09b824540c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An auto export job update instance. + public partial class AutoExportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal + { + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)Property).AdminStatus = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties _property; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags _tag; + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public AutoExportJobUpdate() + { + + } + } + /// An auto export job update instance. + public partial interface IAutoExportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get; set; } + + } + /// An auto export job update instance. + internal partial interface IAutoExportJobUpdateInternal + + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties Property { get; set; } + /// Resource tags. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.json.cs new file mode 100644 index 000000000000..5795d02e4c08 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdate.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An auto export job update instance. + public partial class AutoExportJobUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobUpdate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateProperties.FromJson(__jsonProperties) : _property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTags.FromJson(__jsonTags) : _tag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..0f08a2169fb8 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdatePropertiesTypeConverter))] + public partial class AutoExportJobUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdatePropertiesTypeConverter))] + public partial interface IAutoExportJobUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..1df7681154b4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.cs new file mode 100644 index 000000000000..88762bf8f5da --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoExportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdatePropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Creates an new instance. + public AutoExportJobUpdateProperties() + { + + } + } + public partial interface IAutoExportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + } + internal partial interface IAutoExportJobUpdatePropertiesInternal + + { + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.json.cs new file mode 100644 index 000000000000..bfbc60c14644 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateProperties.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoExportJobUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobUpdateProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..aa4d6396e34a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdateTagsTypeConverter))] + public partial class AutoExportJobUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobUpdateTagsTypeConverter))] + public partial interface IAutoExportJobUpdateTags + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..65995580424e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.cs new file mode 100644 index 000000000000..7c0ab044e59a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class AutoExportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTagsInternal + { + + /// Creates an new instance. + public AutoExportJobUpdateTags() + { + + } + } + /// Resource tags. + public partial interface IAutoExportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + + } + /// Resource tags. + internal partial interface IAutoExportJobUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.dictionary.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.dictionary.cs new file mode 100644 index 000000000000..02863160fab2 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoExportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.json.cs new file mode 100644 index 000000000000..085b16f92083 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobUpdateTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class AutoExportJobUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AutoExportJobUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobUpdateTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.PowerShell.cs new file mode 100644 index 000000000000..942c7879fe56 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + /// + [System.ComponentModel.TypeConverter(typeof(AutoExportJobsListResultTypeConverter))] + public partial class AutoExportJobsListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobsListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobsListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobsListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobsListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + [System.ComponentModel.TypeConverter(typeof(AutoExportJobsListResultTypeConverter))] + public partial interface IAutoExportJobsListResult + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.TypeConverter.cs new file mode 100644 index 000000000000..376c63a37c09 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobsListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobsListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobsListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobsListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.cs new file mode 100644 index 000000000000..4d72d13348a1 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + /// + public partial class AutoExportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of auto export job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// List of auto export jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AutoExportJobsListResult() + { + + } + } + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + public partial interface IAutoExportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// URL to get the next set of auto export job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of auto export job list results, if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// List of auto export jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of auto export jobs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob) })] + System.Collections.Generic.List Value { get; set; } + + } + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + internal partial interface IAutoExportJobsListResultInternal + + { + /// URL to get the next set of auto export job list results, if there are any. + string NextLink { get; set; } + /// List of auto export jobs. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.json.cs new file mode 100644 index 000000000000..1f7ed27fa1e4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsListResult.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list auto export jobs. It contains a list of auto export jobs and a URL link to get the next + /// set of results. + /// + public partial class AutoExportJobsListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobsListResult(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob) (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(__u) )) ))() : null : _value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobsListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.PowerShell.cs new file mode 100644 index 000000000000..2c5071d240c9 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.PowerShell.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(AutoExportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial class AutoExportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoExportJobsUpdateAcceptedResponseHeaders(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoExportJobsUpdateAcceptedResponseHeaders(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoExportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoExportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(AutoExportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial interface IAutoExportJobsUpdateAcceptedResponseHeaders + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs new file mode 100644 index 000000000000..128751ded9b1 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoExportJobsUpdateAcceptedResponseHeadersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoExportJobsUpdateAcceptedResponseHeaders.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoExportJobsUpdateAcceptedResponseHeaders.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoExportJobsUpdateAcceptedResponseHeaders.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.cs new file mode 100644 index 000000000000..eb611b3d7b32 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoExportJobsUpdateAcceptedResponseHeaders : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// + /// Creates an new instance. + /// + public AutoExportJobsUpdateAcceptedResponseHeaders() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + } + public partial interface IAutoExportJobsUpdateAcceptedResponseHeaders + + { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + + } + internal partial interface IAutoExportJobsUpdateAcceptedResponseHeadersInternal + + { + string AzureAsyncOperation { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.json.cs new file mode 100644 index 000000000000..0845fb413ae6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoExportJobsUpdateAcceptedResponseHeaders.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoExportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoExportJobsUpdateAcceptedResponseHeaders(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsUpdateAcceptedResponseHeaders FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoExportJobsUpdateAcceptedResponseHeaders(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.PowerShell.cs new file mode 100644 index 000000000000..a731fe5ea51c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.PowerShell.cs @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + [System.ComponentModel.TypeConverter(typeof(AutoImportJobTypeConverter))] + public partial class AutoImportJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJob(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AutoImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AutoImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("EnableDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).EnableDeletion = (bool?) content.GetValueForProperty("EnableDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).EnableDeletion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).MaximumError = (long?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).MaximumError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJob(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AutoImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AutoImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("EnableDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).EnableDeletion = (bool?) content.GetValueForProperty("EnableDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).EnableDeletion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).MaximumError = (long?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).MaximumError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJob(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + [System.ComponentModel.TypeConverter(typeof(AutoImportJobTypeConverter))] + public partial interface IAutoImportJob + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.TypeConverter.cs new file mode 100644 index 000000000000..6a181857e468 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.cs new file mode 100644 index 000000000000..e50cf4a0c98c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.cs @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class AutoImportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IValidates, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).AdminStatus = value ?? null; } + + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AutoImportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).AutoImportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).AutoImportPrefix = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string ConflictResolutionMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).ConflictResolutionMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).ConflictResolutionMode = value ?? null; } + + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public bool? EnableDeletion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).EnableDeletion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).EnableDeletion = value ?? default(bool); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } + + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? MaximumError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).MaximumError; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).MaximumError = value ?? default(long); } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).Status = value ?? null /* model class */; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name = value ?? null; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties _property; + + /// Properties of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobProperties()); set => this._property = value; } + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The status of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)Property).Status; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public AutoImportJob() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + public partial interface IAutoImportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.", + SerializedName = @"autoImportPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AutoImportPrefix { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Whether or not to enable deletions during auto import. This only affects overwrite-dirty.", + SerializedName = @"enableDeletions", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableDeletion { get; set; } + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(long) })] + long? MaximumError { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// The status of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status of the auto import job.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get; } + + } + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + internal partial interface IAutoImportJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + System.Collections.Generic.List AutoImportPrefix { get; set; } + + string AzureAsyncOperation { get; set; } + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + bool? EnableDeletion { get; set; } + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + long? MaximumError { get; set; } + /// Properties of the auto import job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties Property { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the auto import job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.json.cs new file mode 100644 index 000000000000..888d8744cf9f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJob.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class AutoImportJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJob(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJob(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.PowerShell.cs new file mode 100644 index 000000000000..ada649d85bea --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Properties of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesTypeConverter))] + public partial class AutoImportJobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AutoImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AutoImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("EnableDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).EnableDeletion = (bool?) content.GetValueForProperty("EnableDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).EnableDeletion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).MaximumError = (long?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).MaximumError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("AutoImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AutoImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("AutoImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).AutoImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("EnableDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).EnableDeletion = (bool?) content.GetValueForProperty("EnableDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).EnableDeletion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).MaximumError = (long?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).MaximumError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Properties of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesTypeConverter))] + public partial interface IAutoImportJobProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.TypeConverter.cs new file mode 100644 index 000000000000..065e3bb74ada --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.cs new file mode 100644 index 000000000000..1e69643fb255 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the auto import job. + public partial class AutoImportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Backing field for property. + private System.Collections.Generic.List _autoImportPrefix; + + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List AutoImportPrefix { get => this._autoImportPrefix; set => this._autoImportPrefix = value; } + + /// Backing field for property. + private string _conflictResolutionMode; + + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ConflictResolutionMode { get => this._conflictResolutionMode; set => this._conflictResolutionMode = value; } + + /// Backing field for property. + private bool? _enableDeletion; + + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public bool? EnableDeletion { get => this._enableDeletion; set => this._enableDeletion = value; } + + /// Backing field for property. + private long? _maximumError; + + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? MaximumError { get => this._maximumError; set => this._maximumError = value; } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatus()); set { {_status = value;} } } + + /// Backing field for property. + private string _provisioningState; + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus _status; + + /// The status of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatus()); } + + /// Creates an new instance. + public AutoImportJobProperties() + { + + } + } + /// Properties of the auto import job. + public partial interface IAutoImportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.", + SerializedName = @"autoImportPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AutoImportPrefix { get; set; } + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Whether or not to enable deletions during auto import. This only affects overwrite-dirty.", + SerializedName = @"enableDeletions", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableDeletion { get; set; } + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(long) })] + long? MaximumError { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// The status of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status of the auto import job.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get; } + + } + /// Properties of the auto import job. + internal partial interface IAutoImportJobPropertiesInternal + + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + System.Collections.Generic.List AutoImportPrefix { get; set; } + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + bool? EnableDeletion { get; set; } + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + long? MaximumError { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the auto import job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus Status { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.json.cs new file mode 100644 index 000000000000..c9765515cd67 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobProperties.json.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the auto import job. + public partial class AutoImportJobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + {_autoImportPrefix = If( json?.PropertyT("autoImportPrefixes"), out var __jsonAutoImportPrefixes) ? If( __jsonAutoImportPrefixes as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _autoImportPrefix;} + {_conflictResolutionMode = If( json?.PropertyT("conflictResolutionMode"), out var __jsonConflictResolutionMode) ? (string)__jsonConflictResolutionMode : (string)_conflictResolutionMode;} + {_enableDeletion = If( json?.PropertyT("enableDeletions"), out var __jsonEnableDeletions) ? (bool?)__jsonEnableDeletions : _enableDeletion;} + {_maximumError = If( json?.PropertyT("maximumErrors"), out var __jsonMaximumErrors) ? (long?)__jsonMaximumErrors : _maximumError;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatus.FromJson(__jsonStatus) : _status;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + if (null != this._autoImportPrefix) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._autoImportPrefix ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("autoImportPrefixes",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._conflictResolutionMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._conflictResolutionMode.ToString()) : null, "conflictResolutionMode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._enableDeletion ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonBoolean((bool)this._enableDeletion) : null, "enableDeletions" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._maximumError ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._maximumError) : null, "maximumErrors" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.PowerShell.cs new file mode 100644 index 000000000000..dafc45444dfd --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.PowerShell.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The status of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesStatusTypeConverter))] + public partial class AutoImportJobPropertiesStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobPropertiesStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobSyncEvent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEvent = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents) content.GetValueForProperty("BlobSyncEvent",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEvent, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEventsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ScanStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanStartTime = (global::System.DateTime?) content.GetValueForProperty("ScanStartTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ScanEndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanEndTime = (global::System.DateTime?) content.GetValueForProperty("ScanEndTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsWalked = (long?) content.GetValueForProperty("TotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobWalk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobWalk = (long?) content.GetValueForProperty("RateOfBlobWalk",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobWalk, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobImport = (long?) content.GetValueForProperty("RateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalError = (long?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalConflict = (long?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("BlobSyncEventImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedFile = (long?) content.GetValueForProperty("BlobSyncEventImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedDirectory = (long?) content.GetValueForProperty("BlobSyncEventImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedSymlink = (long?) content.GetValueForProperty("BlobSyncEventImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingFile = (long?) content.GetValueForProperty("BlobSyncEventPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingDirectory = (long?) content.GetValueForProperty("BlobSyncEventPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingSymlink = (long?) content.GetValueForProperty("BlobSyncEventPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalBlobsImported = (long?) content.GetValueForProperty("BlobSyncEventTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventRateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventRateOfBlobImport = (long?) content.GetValueForProperty("BlobSyncEventRateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventRateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalError = (long?) content.GetValueForProperty("BlobSyncEventTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalConflict = (long?) content.GetValueForProperty("BlobSyncEventTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventDeletion = (long?) content.GetValueForProperty("BlobSyncEventDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventDeletion, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventLastChangeFeedEventConsumedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastChangeFeedEventConsumedTime = (global::System.DateTime?) content.GetValueForProperty("BlobSyncEventLastChangeFeedEventConsumedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastChangeFeedEventConsumedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("BlobSyncEventLastTimeFullySynchronized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastTimeFullySynchronized = (global::System.DateTime?) content.GetValueForProperty("BlobSyncEventLastTimeFullySynchronized",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastTimeFullySynchronized, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobPropertiesStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobSyncEvent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEvent = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents) content.GetValueForProperty("BlobSyncEvent",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEvent, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEventsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("ScanStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanStartTime = (global::System.DateTime?) content.GetValueForProperty("ScanStartTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ScanEndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanEndTime = (global::System.DateTime?) content.GetValueForProperty("ScanEndTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ScanEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsWalked = (long?) content.GetValueForProperty("TotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobWalk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobWalk = (long?) content.GetValueForProperty("RateOfBlobWalk",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobWalk, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobImport = (long?) content.GetValueForProperty("RateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).RateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalError = (long?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalConflict = (long?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).TotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastStartedTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastStartedTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastStartedTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastStartedTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastCompletionTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastCompletionTimeUtc = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).LastCompletionTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("BlobSyncEventImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedFile = (long?) content.GetValueForProperty("BlobSyncEventImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedDirectory = (long?) content.GetValueForProperty("BlobSyncEventImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedSymlink = (long?) content.GetValueForProperty("BlobSyncEventImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingFile = (long?) content.GetValueForProperty("BlobSyncEventPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingDirectory = (long?) content.GetValueForProperty("BlobSyncEventPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingSymlink = (long?) content.GetValueForProperty("BlobSyncEventPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalBlobsImported = (long?) content.GetValueForProperty("BlobSyncEventTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventRateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventRateOfBlobImport = (long?) content.GetValueForProperty("BlobSyncEventRateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventRateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalError = (long?) content.GetValueForProperty("BlobSyncEventTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalConflict = (long?) content.GetValueForProperty("BlobSyncEventTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventTotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventDeletion = (long?) content.GetValueForProperty("BlobSyncEventDeletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventDeletion, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobSyncEventLastChangeFeedEventConsumedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastChangeFeedEventConsumedTime = (global::System.DateTime?) content.GetValueForProperty("BlobSyncEventLastChangeFeedEventConsumedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastChangeFeedEventConsumedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("BlobSyncEventLastTimeFullySynchronized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastTimeFullySynchronized = (global::System.DateTime?) content.GetValueForProperty("BlobSyncEventLastTimeFullySynchronized",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal)this).BlobSyncEventLastTimeFullySynchronized, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobPropertiesStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobPropertiesStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The status of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesStatusTypeConverter))] + public partial interface IAutoImportJobPropertiesStatus + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.TypeConverter.cs new file mode 100644 index 000000000000..913c8764246e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobPropertiesStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobPropertiesStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobPropertiesStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobPropertiesStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.cs new file mode 100644 index 000000000000..59552f0a32e6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.cs @@ -0,0 +1,745 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the auto import job. + public partial class AutoImportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents _blobSyncEvent; + + /// The storage account blob change feed status of the auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents BlobSyncEvent { get => (this._blobSyncEvent = this._blobSyncEvent ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEvents()); } + + /// Number of deletions during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventDeletion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).Deletion; } + + /// Number of directories imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedDirectory; } + + /// Number of files imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedFile; } + + /// Number of symlinks imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedSymlink; } + + /// Date and time of the last Change Feed event consumed. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? BlobSyncEventLastChangeFeedEventConsumedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastChangeFeedEventConsumedTime; } + + /// Date and time when last fully synchronized. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? BlobSyncEventLastTimeFullySynchronized { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastTimeFullySynchronized; } + + /// Number of preexisting directories during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingDirectory; } + + /// Number of preexisting files during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingFile; } + + /// Number of preexisting symlinks during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingSymlink; } + + /// Rate of blob import per second during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventRateOfBlobImport { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).RateOfBlobImport; } + + /// Total number of blobs imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalBlobsImported; } + + /// Total conflicts encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalConflict; } + + /// Total errors encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? BlobSyncEventTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalError; } + + /// Backing field for property. + private long? _importedDirectory; + + /// Number of directories imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedDirectory { get => this._importedDirectory; } + + /// Backing field for property. + private long? _importedFile; + + /// Number of files imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedFile { get => this._importedFile; } + + /// Backing field for property. + private long? _importedSymlink; + + /// Number of symlinks imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedSymlink { get => this._importedSymlink; } + + /// Backing field for property. + private global::System.DateTime? _lastCompletionTimeUtc; + + /// The time (in UTC) of the last completed auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastCompletionTimeUtc { get => this._lastCompletionTimeUtc; } + + /// Backing field for property. + private global::System.DateTime? _lastStartedTimeUtc; + + /// The time (in UTC) the latest auto import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastStartedTimeUtc { get => this._lastStartedTimeUtc; } + + /// Internal Acessors for BlobSyncEvent + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEvent { get => (this._blobSyncEvent = this._blobSyncEvent ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEvents()); set { {_blobSyncEvent = value;} } } + + /// Internal Acessors for BlobSyncEventDeletion + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventDeletion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).Deletion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).Deletion = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedDirectory = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedFile = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).ImportedSymlink = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventLastChangeFeedEventConsumedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventLastChangeFeedEventConsumedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastChangeFeedEventConsumedTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastChangeFeedEventConsumedTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for BlobSyncEventLastTimeFullySynchronized + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventLastTimeFullySynchronized { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastTimeFullySynchronized; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).LastTimeFullySynchronized = value ?? default(global::System.DateTime); } + + /// Internal Acessors for BlobSyncEventPreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingDirectory = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventPreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingFile = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventPreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).PreexistingSymlink = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventRateOfBlobImport + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventRateOfBlobImport { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).RateOfBlobImport; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).RateOfBlobImport = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventTotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalBlobsImported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalBlobsImported = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventTotalConflict + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalConflict; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalConflict = value ?? default(long); } + + /// Internal Acessors for BlobSyncEventTotalError + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.BlobSyncEventTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalError; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)BlobSyncEvent).TotalError = value ?? default(long); } + + /// Internal Acessors for ImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.ImportedDirectory { get => this._importedDirectory; set { {_importedDirectory = value;} } } + + /// Internal Acessors for ImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.ImportedFile { get => this._importedFile; set { {_importedFile = value;} } } + + /// Internal Acessors for ImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.ImportedSymlink { get => this._importedSymlink; set { {_importedSymlink = value;} } } + + /// Internal Acessors for LastCompletionTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.LastCompletionTimeUtc { get => this._lastCompletionTimeUtc; set { {_lastCompletionTimeUtc = value;} } } + + /// Internal Acessors for LastStartedTimeUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.LastStartedTimeUtc { get => this._lastStartedTimeUtc; set { {_lastStartedTimeUtc = value;} } } + + /// Internal Acessors for PreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.PreexistingDirectory { get => this._preexistingDirectory; set { {_preexistingDirectory = value;} } } + + /// Internal Acessors for PreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.PreexistingFile { get => this._preexistingFile; set { {_preexistingFile = value;} } } + + /// Internal Acessors for PreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.PreexistingSymlink { get => this._preexistingSymlink; set { {_preexistingSymlink = value;} } } + + /// Internal Acessors for RateOfBlobImport + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.RateOfBlobImport { get => this._rateOfBlobImport; set { {_rateOfBlobImport = value;} } } + + /// Internal Acessors for RateOfBlobWalk + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.RateOfBlobWalk { get => this._rateOfBlobWalk; set { {_rateOfBlobWalk = value;} } } + + /// Internal Acessors for ScanEndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.ScanEndTime { get => this._scanEndTime; set { {_scanEndTime = value;} } } + + /// Internal Acessors for ScanStartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.ScanStartTime { get => this._scanStartTime; set { {_scanStartTime = value;} } } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for StatusCode + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.StatusCode { get => this._statusCode; set { {_statusCode = value;} } } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.StatusMessage { get => this._statusMessage; set { {_statusMessage = value;} } } + + /// Internal Acessors for TotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.TotalBlobsImported { get => this._totalBlobsImported; set { {_totalBlobsImported = value;} } } + + /// Internal Acessors for TotalBlobsWalked + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.TotalBlobsWalked { get => this._totalBlobsWalked; set { {_totalBlobsWalked = value;} } } + + /// Internal Acessors for TotalConflict + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.TotalConflict { get => this._totalConflict; set { {_totalConflict = value;} } } + + /// Internal Acessors for TotalError + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusInternal.TotalError { get => this._totalError; set { {_totalError = value;} } } + + /// Backing field for property. + private long? _preexistingDirectory; + + /// Number of preexisting directories during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingDirectory { get => this._preexistingDirectory; } + + /// Backing field for property. + private long? _preexistingFile; + + /// Number of preexisting files during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingFile { get => this._preexistingFile; } + + /// Backing field for property. + private long? _preexistingSymlink; + + /// Number of preexisting symlinks during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingSymlink { get => this._preexistingSymlink; } + + /// Backing field for property. + private long? _rateOfBlobImport; + + /// Rate of blob import during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? RateOfBlobImport { get => this._rateOfBlobImport; } + + /// Backing field for property. + private long? _rateOfBlobWalk; + + /// Rate of blobs walked during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? RateOfBlobWalk { get => this._rateOfBlobWalk; } + + /// Backing field for property. + private global::System.DateTime? _scanEndTime; + + /// Date and time of when the full scan ended. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? ScanEndTime { get => this._scanEndTime; } + + /// Backing field for property. + private global::System.DateTime? _scanStartTime; + + /// Date and time of when the currently running full scan began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? ScanStartTime { get => this._scanStartTime; } + + /// Backing field for property. + private string _state; + + /// The state of the auto import operation. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string State { get => this._state; } + + /// Backing field for property. + private string _statusCode; + + /// Server-defined status code for auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string StatusCode { get => this._statusCode; } + + /// Backing field for property. + private string _statusMessage; + + /// Server-defined status message for auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string StatusMessage { get => this._statusMessage; } + + /// Backing field for property. + private long? _totalBlobsImported; + + /// Total number of blobs imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalBlobsImported { get => this._totalBlobsImported; } + + /// Backing field for property. + private long? _totalBlobsWalked; + + /// Total number of blobs walked during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalBlobsWalked { get => this._totalBlobsWalked; } + + /// Backing field for property. + private long? _totalConflict; + + /// Total conflicts encountered during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalConflict { get => this._totalConflict; } + + /// Backing field for property. + private long? _totalError; + + /// Total errors encountered during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalError { get => this._totalError; } + + /// Creates an new instance. + public AutoImportJobPropertiesStatus() + { + + } + } + /// The status of the auto import job. + public partial interface IAutoImportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// Number of deletions during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of deletions during auto import.", + SerializedName = @"deletions", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventDeletion { get; } + /// Number of directories imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of directories imported during auto import.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventImportedDirectory { get; } + /// Number of files imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files imported during auto import.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventImportedFile { get; } + /// Number of symlinks imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of symlinks imported during auto import.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventImportedSymlink { get; } + /// Date and time of the last Change Feed event consumed. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time of the last Change Feed event consumed.", + SerializedName = @"lastChangeFeedEventConsumedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? BlobSyncEventLastChangeFeedEventConsumedTime { get; } + /// Date and time when last fully synchronized. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time when last fully synchronized.", + SerializedName = @"lastTimeFullySynchronized", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? BlobSyncEventLastTimeFullySynchronized { get; } + /// Number of preexisting directories during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting directories during auto import.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventPreexistingDirectory { get; } + /// Number of preexisting files during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting files during auto import.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventPreexistingFile { get; } + /// Number of preexisting symlinks during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting symlinks during auto import.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventPreexistingSymlink { get; } + /// Rate of blob import per second during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Rate of blob import per second during auto import.", + SerializedName = @"rateOfBlobImport", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventRateOfBlobImport { get; } + /// Total number of blobs imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total number of blobs imported during auto import.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventTotalBlobsImported { get; } + /// Total conflicts encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total conflicts encountered during auto import.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventTotalConflict { get; } + /// Total errors encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total errors encountered during auto import.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(long) })] + long? BlobSyncEventTotalError { get; } + /// Number of directories imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of directories imported during full scan.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? ImportedDirectory { get; } + /// Number of files imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files imported during full scan.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? ImportedFile { get; } + /// Number of symlinks imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of symlinks imported during full scan.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? ImportedSymlink { get; } + /// The time (in UTC) of the last completed auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed auto import job.", + SerializedName = @"lastCompletionTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastCompletionTimeUtc { get; } + /// The time (in UTC) the latest auto import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest auto import job started.", + SerializedName = @"lastStartedTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStartedTimeUtc { get; } + /// Number of preexisting directories during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting directories during full scan.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingDirectory { get; } + /// Number of preexisting files during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting files during full scan.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingFile { get; } + /// Number of preexisting symlinks during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting symlinks during full scan.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingSymlink { get; } + /// Rate of blob import during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Rate of blob import during full scan.", + SerializedName = @"rateOfBlobImport", + PossibleTypes = new [] { typeof(long) })] + long? RateOfBlobImport { get; } + /// Rate of blobs walked during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Rate of blobs walked during full scan.", + SerializedName = @"rateOfBlobWalk", + PossibleTypes = new [] { typeof(long) })] + long? RateOfBlobWalk { get; } + /// Date and time of when the full scan ended. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time of when the full scan ended.", + SerializedName = @"scanEndTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ScanEndTime { get; } + /// Date and time of when the currently running full scan began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time of when the currently running full scan began.", + SerializedName = @"scanStartTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ScanStartTime { get; } + /// The state of the auto import operation. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The state of the auto import operation.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Failed", "Disabling", "Disabled")] + string State { get; } + /// Server-defined status code for auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status code for auto import job.", + SerializedName = @"statusCode", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; } + /// Server-defined status message for auto import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Server-defined status message for auto import job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// Total number of blobs imported during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total number of blobs imported during full scan.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? TotalBlobsImported { get; } + /// Total number of blobs walked during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total number of blobs walked during full scan.", + SerializedName = @"totalBlobsWalked", + PossibleTypes = new [] { typeof(long) })] + long? TotalBlobsWalked { get; } + /// Total conflicts encountered during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total conflicts encountered during full scan.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(long) })] + long? TotalConflict { get; } + /// Total errors encountered during full scan. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total errors encountered during full scan.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(long) })] + long? TotalError { get; } + + } + /// The status of the auto import job. + internal partial interface IAutoImportJobPropertiesStatusInternal + + { + /// The storage account blob change feed status of the auto import job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents BlobSyncEvent { get; set; } + /// Number of deletions during auto import. + long? BlobSyncEventDeletion { get; set; } + /// Number of directories imported during auto import. + long? BlobSyncEventImportedDirectory { get; set; } + /// Number of files imported during auto import. + long? BlobSyncEventImportedFile { get; set; } + /// Number of symlinks imported during auto import. + long? BlobSyncEventImportedSymlink { get; set; } + /// Date and time of the last Change Feed event consumed. + global::System.DateTime? BlobSyncEventLastChangeFeedEventConsumedTime { get; set; } + /// Date and time when last fully synchronized. + global::System.DateTime? BlobSyncEventLastTimeFullySynchronized { get; set; } + /// Number of preexisting directories during auto import. + long? BlobSyncEventPreexistingDirectory { get; set; } + /// Number of preexisting files during auto import. + long? BlobSyncEventPreexistingFile { get; set; } + /// Number of preexisting symlinks during auto import. + long? BlobSyncEventPreexistingSymlink { get; set; } + /// Rate of blob import per second during auto import. + long? BlobSyncEventRateOfBlobImport { get; set; } + /// Total number of blobs imported during auto import. + long? BlobSyncEventTotalBlobsImported { get; set; } + /// Total conflicts encountered during auto import. + long? BlobSyncEventTotalConflict { get; set; } + /// Total errors encountered during auto import. + long? BlobSyncEventTotalError { get; set; } + /// Number of directories imported during full scan. + long? ImportedDirectory { get; set; } + /// Number of files imported during full scan. + long? ImportedFile { get; set; } + /// Number of symlinks imported during full scan. + long? ImportedSymlink { get; set; } + /// The time (in UTC) of the last completed auto import job. + global::System.DateTime? LastCompletionTimeUtc { get; set; } + /// The time (in UTC) the latest auto import job started. + global::System.DateTime? LastStartedTimeUtc { get; set; } + /// Number of preexisting directories during full scan. + long? PreexistingDirectory { get; set; } + /// Number of preexisting files during full scan. + long? PreexistingFile { get; set; } + /// Number of preexisting symlinks during full scan. + long? PreexistingSymlink { get; set; } + /// Rate of blob import during full scan. + long? RateOfBlobImport { get; set; } + /// Rate of blobs walked during full scan. + long? RateOfBlobWalk { get; set; } + /// Date and time of when the full scan ended. + global::System.DateTime? ScanEndTime { get; set; } + /// Date and time of when the currently running full scan began. + global::System.DateTime? ScanStartTime { get; set; } + /// The state of the auto import operation. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Failed", "Disabling", "Disabled")] + string State { get; set; } + /// Server-defined status code for auto import job. + string StatusCode { get; set; } + /// Server-defined status message for auto import job. + string StatusMessage { get; set; } + /// Total number of blobs imported during full scan. + long? TotalBlobsImported { get; set; } + /// Total number of blobs walked during full scan. + long? TotalBlobsWalked { get; set; } + /// Total conflicts encountered during full scan. + long? TotalConflict { get; set; } + /// Total errors encountered during full scan. + long? TotalError { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.json.cs new file mode 100644 index 000000000000..980a0542d898 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatus.json.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the auto import job. + public partial class AutoImportJobPropertiesStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobPropertiesStatus(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_blobSyncEvent = If( json?.PropertyT("blobSyncEvents"), out var __jsonBlobSyncEvents) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobPropertiesStatusBlobSyncEvents.FromJson(__jsonBlobSyncEvents) : _blobSyncEvent;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + {_statusCode = If( json?.PropertyT("statusCode"), out var __jsonStatusCode) ? (string)__jsonStatusCode : (string)_statusCode;} + {_statusMessage = If( json?.PropertyT("statusMessage"), out var __jsonStatusMessage) ? (string)__jsonStatusMessage : (string)_statusMessage;} + {_scanStartTime = If( json?.PropertyT("scanStartTime"), out var __jsonScanStartTime) ? global::System.DateTime.TryParse((string)__jsonScanStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonScanStartTimeValue) ? __jsonScanStartTimeValue : _scanStartTime : _scanStartTime;} + {_scanEndTime = If( json?.PropertyT("scanEndTime"), out var __jsonScanEndTime) ? global::System.DateTime.TryParse((string)__jsonScanEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonScanEndTimeValue) ? __jsonScanEndTimeValue : _scanEndTime : _scanEndTime;} + {_totalBlobsWalked = If( json?.PropertyT("totalBlobsWalked"), out var __jsonTotalBlobsWalked) ? (long?)__jsonTotalBlobsWalked : _totalBlobsWalked;} + {_rateOfBlobWalk = If( json?.PropertyT("rateOfBlobWalk"), out var __jsonRateOfBlobWalk) ? (long?)__jsonRateOfBlobWalk : _rateOfBlobWalk;} + {_totalBlobsImported = If( json?.PropertyT("totalBlobsImported"), out var __jsonTotalBlobsImported) ? (long?)__jsonTotalBlobsImported : _totalBlobsImported;} + {_rateOfBlobImport = If( json?.PropertyT("rateOfBlobImport"), out var __jsonRateOfBlobImport) ? (long?)__jsonRateOfBlobImport : _rateOfBlobImport;} + {_importedFile = If( json?.PropertyT("importedFiles"), out var __jsonImportedFiles) ? (long?)__jsonImportedFiles : _importedFile;} + {_importedDirectory = If( json?.PropertyT("importedDirectories"), out var __jsonImportedDirectories) ? (long?)__jsonImportedDirectories : _importedDirectory;} + {_importedSymlink = If( json?.PropertyT("importedSymlinks"), out var __jsonImportedSymlinks) ? (long?)__jsonImportedSymlinks : _importedSymlink;} + {_preexistingFile = If( json?.PropertyT("preexistingFiles"), out var __jsonPreexistingFiles) ? (long?)__jsonPreexistingFiles : _preexistingFile;} + {_preexistingDirectory = If( json?.PropertyT("preexistingDirectories"), out var __jsonPreexistingDirectories) ? (long?)__jsonPreexistingDirectories : _preexistingDirectory;} + {_preexistingSymlink = If( json?.PropertyT("preexistingSymlinks"), out var __jsonPreexistingSymlinks) ? (long?)__jsonPreexistingSymlinks : _preexistingSymlink;} + {_totalError = If( json?.PropertyT("totalErrors"), out var __jsonTotalErrors) ? (long?)__jsonTotalErrors : _totalError;} + {_totalConflict = If( json?.PropertyT("totalConflicts"), out var __jsonTotalConflicts) ? (long?)__jsonTotalConflicts : _totalConflict;} + {_lastStartedTimeUtc = If( json?.PropertyT("lastStartedTimeUTC"), out var __jsonLastStartedTimeUtc) ? global::System.DateTime.TryParse((string)__jsonLastStartedTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastStartedTimeUtcValue) ? __jsonLastStartedTimeUtcValue : _lastStartedTimeUtc : _lastStartedTimeUtc;} + {_lastCompletionTimeUtc = If( json?.PropertyT("lastCompletionTimeUTC"), out var __jsonLastCompletionTimeUtc) ? global::System.DateTime.TryParse((string)__jsonLastCompletionTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastCompletionTimeUtcValue) ? __jsonLastCompletionTimeUtcValue : _lastCompletionTimeUtc : _lastCompletionTimeUtc;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobPropertiesStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._blobSyncEvent ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._blobSyncEvent.ToJson(null,serializationMode) : null, "blobSyncEvents" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._statusCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._statusCode.ToString()) : null, "statusCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._statusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._statusMessage.ToString()) : null, "statusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._scanStartTime ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._scanStartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "scanStartTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._scanEndTime ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._scanEndTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "scanEndTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBlobsWalked ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalBlobsWalked) : null, "totalBlobsWalked" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._rateOfBlobWalk ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._rateOfBlobWalk) : null, "rateOfBlobWalk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBlobsImported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalBlobsImported) : null, "totalBlobsImported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._rateOfBlobImport ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._rateOfBlobImport) : null, "rateOfBlobImport" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedFile) : null, "importedFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedDirectory) : null, "importedDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedSymlink) : null, "importedSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingFile) : null, "preexistingFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingDirectory) : null, "preexistingDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingSymlink) : null, "preexistingSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalError ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalError) : null, "totalErrors" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalConflict ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalConflict) : null, "totalConflicts" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastStartedTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastStartedTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastStartedTimeUTC" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastCompletionTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastCompletionTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastCompletionTimeUTC" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.PowerShell.cs new file mode 100644 index 000000000000..3dc96a742ea4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.PowerShell.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The storage account blob change feed status of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesStatusBlobSyncEventsTypeConverter))] + public partial class AutoImportJobPropertiesStatusBlobSyncEvents + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobPropertiesStatusBlobSyncEvents(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).RateOfBlobImport = (long?) content.GetValueForProperty("RateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).RateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalError = (long?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalConflict = (long?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Deletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).Deletion = (long?) content.GetValueForProperty("Deletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).Deletion, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastChangeFeedEventConsumedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastChangeFeedEventConsumedTime = (global::System.DateTime?) content.GetValueForProperty("LastChangeFeedEventConsumedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastChangeFeedEventConsumedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTimeFullySynchronized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastTimeFullySynchronized = (global::System.DateTime?) content.GetValueForProperty("LastTimeFullySynchronized",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastTimeFullySynchronized, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobPropertiesStatusBlobSyncEvents(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RateOfBlobImport")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).RateOfBlobImport = (long?) content.GetValueForProperty("RateOfBlobImport",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).RateOfBlobImport, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalError = (long?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalError, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalConflict = (long?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).TotalConflict, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Deletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).Deletion = (long?) content.GetValueForProperty("Deletion",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).Deletion, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastChangeFeedEventConsumedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastChangeFeedEventConsumedTime = (global::System.DateTime?) content.GetValueForProperty("LastChangeFeedEventConsumedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastChangeFeedEventConsumedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTimeFullySynchronized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastTimeFullySynchronized = (global::System.DateTime?) content.GetValueForProperty("LastTimeFullySynchronized",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal)this).LastTimeFullySynchronized, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobPropertiesStatusBlobSyncEvents(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobPropertiesStatusBlobSyncEvents(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The storage account blob change feed status of the auto import job. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobPropertiesStatusBlobSyncEventsTypeConverter))] + public partial interface IAutoImportJobPropertiesStatusBlobSyncEvents + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.TypeConverter.cs new file mode 100644 index 000000000000..f8f8726d706e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobPropertiesStatusBlobSyncEventsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobPropertiesStatusBlobSyncEvents.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobPropertiesStatusBlobSyncEvents.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobPropertiesStatusBlobSyncEvents.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.cs new file mode 100644 index 000000000000..99748780ad84 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.cs @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The storage account blob change feed status of the auto import job. + public partial class AutoImportJobPropertiesStatusBlobSyncEvents : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal + { + + /// Backing field for property. + private long? _deletion; + + /// Number of deletions during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? Deletion { get => this._deletion; } + + /// Backing field for property. + private long? _importedDirectory; + + /// Number of directories imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedDirectory { get => this._importedDirectory; } + + /// Backing field for property. + private long? _importedFile; + + /// Number of files imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedFile { get => this._importedFile; } + + /// Backing field for property. + private long? _importedSymlink; + + /// Number of symlinks imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedSymlink { get => this._importedSymlink; } + + /// Backing field for property. + private global::System.DateTime? _lastChangeFeedEventConsumedTime; + + /// Date and time of the last Change Feed event consumed. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastChangeFeedEventConsumedTime { get => this._lastChangeFeedEventConsumedTime; } + + /// Backing field for property. + private global::System.DateTime? _lastTimeFullySynchronized; + + /// Date and time when last fully synchronized. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastTimeFullySynchronized { get => this._lastTimeFullySynchronized; } + + /// Internal Acessors for Deletion + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.Deletion { get => this._deletion; set { {_deletion = value;} } } + + /// Internal Acessors for ImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.ImportedDirectory { get => this._importedDirectory; set { {_importedDirectory = value;} } } + + /// Internal Acessors for ImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.ImportedFile { get => this._importedFile; set { {_importedFile = value;} } } + + /// Internal Acessors for ImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.ImportedSymlink { get => this._importedSymlink; set { {_importedSymlink = value;} } } + + /// Internal Acessors for LastChangeFeedEventConsumedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.LastChangeFeedEventConsumedTime { get => this._lastChangeFeedEventConsumedTime; set { {_lastChangeFeedEventConsumedTime = value;} } } + + /// Internal Acessors for LastTimeFullySynchronized + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.LastTimeFullySynchronized { get => this._lastTimeFullySynchronized; set { {_lastTimeFullySynchronized = value;} } } + + /// Internal Acessors for PreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.PreexistingDirectory { get => this._preexistingDirectory; set { {_preexistingDirectory = value;} } } + + /// Internal Acessors for PreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.PreexistingFile { get => this._preexistingFile; set { {_preexistingFile = value;} } } + + /// Internal Acessors for PreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.PreexistingSymlink { get => this._preexistingSymlink; set { {_preexistingSymlink = value;} } } + + /// Internal Acessors for RateOfBlobImport + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.RateOfBlobImport { get => this._rateOfBlobImport; set { {_rateOfBlobImport = value;} } } + + /// Internal Acessors for TotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.TotalBlobsImported { get => this._totalBlobsImported; set { {_totalBlobsImported = value;} } } + + /// Internal Acessors for TotalConflict + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.TotalConflict { get => this._totalConflict; set { {_totalConflict = value;} } } + + /// Internal Acessors for TotalError + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEventsInternal.TotalError { get => this._totalError; set { {_totalError = value;} } } + + /// Backing field for property. + private long? _preexistingDirectory; + + /// Number of preexisting directories during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingDirectory { get => this._preexistingDirectory; } + + /// Backing field for property. + private long? _preexistingFile; + + /// Number of preexisting files during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingFile { get => this._preexistingFile; } + + /// Backing field for property. + private long? _preexistingSymlink; + + /// Number of preexisting symlinks during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingSymlink { get => this._preexistingSymlink; } + + /// Backing field for property. + private long? _rateOfBlobImport; + + /// Rate of blob import per second during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? RateOfBlobImport { get => this._rateOfBlobImport; } + + /// Backing field for property. + private long? _totalBlobsImported; + + /// Total number of blobs imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalBlobsImported { get => this._totalBlobsImported; } + + /// Backing field for property. + private long? _totalConflict; + + /// Total conflicts encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalConflict { get => this._totalConflict; } + + /// Backing field for property. + private long? _totalError; + + /// Total errors encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalError { get => this._totalError; } + + /// + /// Creates an new instance. + /// + public AutoImportJobPropertiesStatusBlobSyncEvents() + { + + } + } + /// The storage account blob change feed status of the auto import job. + public partial interface IAutoImportJobPropertiesStatusBlobSyncEvents : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// Number of deletions during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of deletions during auto import.", + SerializedName = @"deletions", + PossibleTypes = new [] { typeof(long) })] + long? Deletion { get; } + /// Number of directories imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of directories imported during auto import.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? ImportedDirectory { get; } + /// Number of files imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files imported during auto import.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? ImportedFile { get; } + /// Number of symlinks imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of symlinks imported during auto import.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? ImportedSymlink { get; } + /// Date and time of the last Change Feed event consumed. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time of the last Change Feed event consumed.", + SerializedName = @"lastChangeFeedEventConsumedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastChangeFeedEventConsumedTime { get; } + /// Date and time when last fully synchronized. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Date and time when last fully synchronized.", + SerializedName = @"lastTimeFullySynchronized", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastTimeFullySynchronized { get; } + /// Number of preexisting directories during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting directories during auto import.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingDirectory { get; } + /// Number of preexisting files during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting files during auto import.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingFile { get; } + /// Number of preexisting symlinks during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of preexisting symlinks during auto import.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingSymlink { get; } + /// Rate of blob import per second during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Rate of blob import per second during auto import.", + SerializedName = @"rateOfBlobImport", + PossibleTypes = new [] { typeof(long) })] + long? RateOfBlobImport { get; } + /// Total number of blobs imported during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total number of blobs imported during auto import.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? TotalBlobsImported { get; } + /// Total conflicts encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total conflicts encountered during auto import.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(long) })] + long? TotalConflict { get; } + /// Total errors encountered during auto import. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total errors encountered during auto import.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(long) })] + long? TotalError { get; } + + } + /// The storage account blob change feed status of the auto import job. + internal partial interface IAutoImportJobPropertiesStatusBlobSyncEventsInternal + + { + /// Number of deletions during auto import. + long? Deletion { get; set; } + /// Number of directories imported during auto import. + long? ImportedDirectory { get; set; } + /// Number of files imported during auto import. + long? ImportedFile { get; set; } + /// Number of symlinks imported during auto import. + long? ImportedSymlink { get; set; } + /// Date and time of the last Change Feed event consumed. + global::System.DateTime? LastChangeFeedEventConsumedTime { get; set; } + /// Date and time when last fully synchronized. + global::System.DateTime? LastTimeFullySynchronized { get; set; } + /// Number of preexisting directories during auto import. + long? PreexistingDirectory { get; set; } + /// Number of preexisting files during auto import. + long? PreexistingFile { get; set; } + /// Number of preexisting symlinks during auto import. + long? PreexistingSymlink { get; set; } + /// Rate of blob import per second during auto import. + long? RateOfBlobImport { get; set; } + /// Total number of blobs imported during auto import. + long? TotalBlobsImported { get; set; } + /// Total conflicts encountered during auto import. + long? TotalConflict { get; set; } + /// Total errors encountered during auto import. + long? TotalError { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.json.cs new file mode 100644 index 000000000000..2b21a8697f46 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobPropertiesStatusBlobSyncEvents.json.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The storage account blob change feed status of the auto import job. + public partial class AutoImportJobPropertiesStatusBlobSyncEvents + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobPropertiesStatusBlobSyncEvents(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_importedFile = If( json?.PropertyT("importedFiles"), out var __jsonImportedFiles) ? (long?)__jsonImportedFiles : _importedFile;} + {_importedDirectory = If( json?.PropertyT("importedDirectories"), out var __jsonImportedDirectories) ? (long?)__jsonImportedDirectories : _importedDirectory;} + {_importedSymlink = If( json?.PropertyT("importedSymlinks"), out var __jsonImportedSymlinks) ? (long?)__jsonImportedSymlinks : _importedSymlink;} + {_preexistingFile = If( json?.PropertyT("preexistingFiles"), out var __jsonPreexistingFiles) ? (long?)__jsonPreexistingFiles : _preexistingFile;} + {_preexistingDirectory = If( json?.PropertyT("preexistingDirectories"), out var __jsonPreexistingDirectories) ? (long?)__jsonPreexistingDirectories : _preexistingDirectory;} + {_preexistingSymlink = If( json?.PropertyT("preexistingSymlinks"), out var __jsonPreexistingSymlinks) ? (long?)__jsonPreexistingSymlinks : _preexistingSymlink;} + {_totalBlobsImported = If( json?.PropertyT("totalBlobsImported"), out var __jsonTotalBlobsImported) ? (long?)__jsonTotalBlobsImported : _totalBlobsImported;} + {_rateOfBlobImport = If( json?.PropertyT("rateOfBlobImport"), out var __jsonRateOfBlobImport) ? (long?)__jsonRateOfBlobImport : _rateOfBlobImport;} + {_totalError = If( json?.PropertyT("totalErrors"), out var __jsonTotalErrors) ? (long?)__jsonTotalErrors : _totalError;} + {_totalConflict = If( json?.PropertyT("totalConflicts"), out var __jsonTotalConflicts) ? (long?)__jsonTotalConflicts : _totalConflict;} + {_deletion = If( json?.PropertyT("deletions"), out var __jsonDeletions) ? (long?)__jsonDeletions : _deletion;} + {_lastChangeFeedEventConsumedTime = If( json?.PropertyT("lastChangeFeedEventConsumedTime"), out var __jsonLastChangeFeedEventConsumedTime) ? global::System.DateTime.TryParse((string)__jsonLastChangeFeedEventConsumedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastChangeFeedEventConsumedTimeValue) ? __jsonLastChangeFeedEventConsumedTimeValue : _lastChangeFeedEventConsumedTime : _lastChangeFeedEventConsumedTime;} + {_lastTimeFullySynchronized = If( json?.PropertyT("lastTimeFullySynchronized"), out var __jsonLastTimeFullySynchronized) ? global::System.DateTime.TryParse((string)__jsonLastTimeFullySynchronized, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastTimeFullySynchronizedValue) ? __jsonLastTimeFullySynchronizedValue : _lastTimeFullySynchronized : _lastTimeFullySynchronized;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobPropertiesStatusBlobSyncEvents FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobPropertiesStatusBlobSyncEvents(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedFile) : null, "importedFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedDirectory) : null, "importedDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedSymlink) : null, "importedSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingFile) : null, "preexistingFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingDirectory) : null, "preexistingDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingSymlink) : null, "preexistingSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBlobsImported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalBlobsImported) : null, "totalBlobsImported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._rateOfBlobImport ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._rateOfBlobImport) : null, "rateOfBlobImport" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalError ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalError) : null, "totalErrors" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalConflict ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalConflict) : null, "totalConflicts" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._deletion ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._deletion) : null, "deletions" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastChangeFeedEventConsumedTime ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastChangeFeedEventConsumedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastChangeFeedEventConsumedTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastTimeFullySynchronized ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastTimeFullySynchronized?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastTimeFullySynchronized" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.PowerShell.cs new file mode 100644 index 000000000000..abdb3721c9ed --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// An auto import job update instance. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdateTypeConverter))] + public partial class AutoImportJobUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An auto import job update instance. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdateTypeConverter))] + public partial interface IAutoImportJobUpdate + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.TypeConverter.cs new file mode 100644 index 000000000000..24aca47d2f6c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.cs new file mode 100644 index 000000000000..b34cccfc3b47 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An auto import job update instance. + public partial class AutoImportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal + { + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)Property).AdminStatus = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties _property; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags _tag; + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public AutoImportJobUpdate() + { + + } + } + /// An auto import job update instance. + public partial interface IAutoImportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get; set; } + + } + /// An auto import job update instance. + internal partial interface IAutoImportJobUpdateInternal + + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties Property { get; set; } + /// Resource tags. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.json.cs new file mode 100644 index 000000000000..80d4daa6d715 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdate.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An auto import job update instance. + public partial class AutoImportJobUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobUpdate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateProperties.FromJson(__jsonProperties) : _property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTags.FromJson(__jsonTags) : _tag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..d04075daff8f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdatePropertiesTypeConverter))] + public partial class AutoImportJobUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdatePropertiesTypeConverter))] + public partial interface IAutoImportJobUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..1ae48baf0335 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.cs new file mode 100644 index 000000000000..9e1df5d74aed --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoImportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdatePropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Creates an new instance. + public AutoImportJobUpdateProperties() + { + + } + } + public partial interface IAutoImportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + } + internal partial interface IAutoImportJobUpdatePropertiesInternal + + { + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + string AdminStatus { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.json.cs new file mode 100644 index 000000000000..7563149aa5de --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateProperties.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoImportJobUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobUpdateProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..2981d9d5df93 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdateTagsTypeConverter))] + public partial class AutoImportJobUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobUpdateTagsTypeConverter))] + public partial interface IAutoImportJobUpdateTags + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..1c6774a26699 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.cs new file mode 100644 index 000000000000..553b1dc0d064 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class AutoImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTagsInternal + { + + /// Creates an new instance. + public AutoImportJobUpdateTags() + { + + } + } + /// Resource tags. + public partial interface IAutoImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + + } + /// Resource tags. + internal partial interface IAutoImportJobUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.dictionary.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.dictionary.cs new file mode 100644 index 000000000000..1b9c4a9770ef --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.json.cs new file mode 100644 index 000000000000..31cdea97ab73 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobUpdateTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class AutoImportJobUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AutoImportJobUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobUpdateTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.PowerShell.cs new file mode 100644 index 000000000000..04b1ce0a1b45 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + /// + [System.ComponentModel.TypeConverter(typeof(AutoImportJobsListResultTypeConverter))] + public partial class AutoImportJobsListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobsListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobsListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobsListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobsListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + [System.ComponentModel.TypeConverter(typeof(AutoImportJobsListResultTypeConverter))] + public partial interface IAutoImportJobsListResult + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.TypeConverter.cs new file mode 100644 index 000000000000..6294aafdbdb9 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobsListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobsListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobsListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobsListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.cs new file mode 100644 index 000000000000..48e57cb5775f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + /// + public partial class AutoImportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of auto import job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// List of auto import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AutoImportJobsListResult() + { + + } + } + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + public partial interface IAutoImportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// URL to get the next set of auto import job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of auto import job list results, if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// List of auto import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of auto import jobs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob) })] + System.Collections.Generic.List Value { get; set; } + + } + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + internal partial interface IAutoImportJobsListResultInternal + + { + /// URL to get the next set of auto import job list results, if there are any. + string NextLink { get; set; } + /// List of auto import jobs. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.json.cs new file mode 100644 index 000000000000..cb5b99500d4c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsListResult.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list auto import jobs. It contains a list of auto import jobs and a URL link to get the next + /// set of results. + /// + public partial class AutoImportJobsListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobsListResult(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob) (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobsListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs new file mode 100644 index 000000000000..272d264643a9 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(AutoImportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial class AutoImportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutoImportJobsUpdateAcceptedResponseHeaders(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutoImportJobsUpdateAcceptedResponseHeaders(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutoImportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutoImportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(AutoImportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial interface IAutoImportJobsUpdateAcceptedResponseHeaders + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs new file mode 100644 index 000000000000..c30d881c7406 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutoImportJobsUpdateAcceptedResponseHeadersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutoImportJobsUpdateAcceptedResponseHeaders.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutoImportJobsUpdateAcceptedResponseHeaders.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutoImportJobsUpdateAcceptedResponseHeaders.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.cs new file mode 100644 index 000000000000..a86dbc87d9e7 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoImportJobsUpdateAcceptedResponseHeaders : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// + /// Creates an new instance. + /// + public AutoImportJobsUpdateAcceptedResponseHeaders() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + } + public partial interface IAutoImportJobsUpdateAcceptedResponseHeaders + + { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + + } + internal partial interface IAutoImportJobsUpdateAcceptedResponseHeadersInternal + + { + string AzureAsyncOperation { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.json.cs new file mode 100644 index 000000000000..3bc25dbef10d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/AutoImportJobsUpdateAcceptedResponseHeaders.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class AutoImportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal AutoImportJobsUpdateAcceptedResponseHeaders(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsUpdateAcceptedResponseHeaders FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new AutoImportJobsUpdateAcceptedResponseHeaders(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs new file mode 100644 index 000000000000..ce5b1328c067 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial class ErrorAdditionalInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial interface IErrorAdditionalInfo + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs new file mode 100644 index 000000000000..a88547feeb11 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorAdditionalInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorAdditionalInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..6915eb9d16aa --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny _info; + + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.Any()); } + + /// Internal Acessors for Info + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.Any()); set { {_info = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _type; + + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ErrorAdditionalInfo() + { + + } + } + /// The resource management error additional info. + public partial interface IErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The additional info.", + SerializedName = @"info", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny Info { get; } + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The additional info type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The resource management error additional info. + internal partial interface IErrorAdditionalInfoInternal + + { + /// The additional info. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAny Info { get; set; } + /// The additional info type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs new file mode 100644 index 000000000000..2f6ccc413db4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.Any.FromJson(__jsonInfo) : _info;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs new file mode 100644 index 000000000000..513b1af03163 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs new file mode 100644 index 000000000000..4861ea02a68c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.cs new file mode 100644 index 000000000000..7f131376262d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.json.cs new file mode 100644 index 000000000000..fd0b0abed212 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorDetail.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..8daa8cb21042 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..209eb6253a66 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.cs new file mode 100644 index 000000000000..17d499854673 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Target = value ?? null; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetailInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseInternal + + { + /// The error additional info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + System.Collections.Generic.List Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorDetail Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.json.cs new file mode 100644 index 000000000000..8dab138f529b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ErrorResponse.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorDetail.FromJson(__jsonError) : _error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.PowerShell.cs new file mode 100644 index 000000000000..62839feaad7a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.PowerShell.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + [System.ComponentModel.TypeConverter(typeof(ImportJobTypeConverter))] + public partial class ImportJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJob(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJob(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("ImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).MaximumError = (int?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).MaximumError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsWalked = (long?) content.GetValueForProperty("StatusTotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsWalkedPerSecond = (long?) content.GetValueForProperty("StatusBlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsImported = (long?) content.GetValueForProperty("StatusTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedFile = (long?) content.GetValueForProperty("StatusImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedDirectory = (long?) content.GetValueForProperty("StatusImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedSymlink = (long?) content.GetValueForProperty("StatusImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingFile = (long?) content.GetValueForProperty("StatusPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingDirectory = (long?) content.GetValueForProperty("StatusPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingSymlink = (long?) content.GetValueForProperty("StatusPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsImportedPerSecond = (long?) content.GetValueForProperty("StatusBlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastStartedTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalError = (int?) content.GetValueForProperty("StatusTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalConflict = (int?) content.GetValueForProperty("StatusTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJob(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("ImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).MaximumError = (int?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).MaximumError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsWalked = (long?) content.GetValueForProperty("StatusTotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsWalkedPerSecond = (long?) content.GetValueForProperty("StatusBlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsImported = (long?) content.GetValueForProperty("StatusTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedFile = (long?) content.GetValueForProperty("StatusImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedDirectory = (long?) content.GetValueForProperty("StatusImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedSymlink = (long?) content.GetValueForProperty("StatusImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingFile = (long?) content.GetValueForProperty("StatusPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingDirectory = (long?) content.GetValueForProperty("StatusPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingSymlink = (long?) content.GetValueForProperty("StatusPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsImportedPerSecond = (long?) content.GetValueForProperty("StatusBlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusBlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastStartedTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusLastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalError = (int?) content.GetValueForProperty("StatusTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalConflict = (int?) content.GetValueForProperty("StatusTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).StatusTotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + [System.ComponentModel.TypeConverter(typeof(ImportJobTypeConverter))] + public partial interface IImportJob + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.TypeConverter.cs new file mode 100644 index 000000000000..396584fad258 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.cs new file mode 100644 index 000000000000..7653a69035d4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.cs @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class ImportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IValidates, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).AdminStatus = value ?? null; } + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string ConflictResolutionMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ConflictResolutionMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ConflictResolutionMode = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; } + + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ImportPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ImportPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ImportPrefix = value ?? null /* arrayOf */; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } + + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? MaximumError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).MaximumError; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).MaximumError = value ?? default(int); } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ProvisioningState = value ?? null; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).Status = value ?? null /* model class */; } + + /// Internal Acessors for StatusBlobsImportedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusBlobsImportedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsImportedPerSecond; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsImportedPerSecond = value ?? default(long); } + + /// Internal Acessors for StatusBlobsWalkedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusBlobsWalkedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsWalkedPerSecond; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsWalkedPerSecond = value ?? default(long); } + + /// Internal Acessors for StatusImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedDirectory = value ?? default(long); } + + /// Internal Acessors for StatusImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedFile = value ?? default(long); } + + /// Internal Acessors for StatusImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedSymlink = value ?? default(long); } + + /// Internal Acessors for StatusLastCompletionTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusLastCompletionTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastCompletionTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastCompletionTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastStartedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusLastStartedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastStartedTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastStartedTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusMessage = value ?? null; } + + /// Internal Acessors for StatusPreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingDirectory = value ?? default(long); } + + /// Internal Acessors for StatusPreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingFile = value ?? default(long); } + + /// Internal Acessors for StatusPreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingSymlink = value ?? default(long); } + + /// Internal Acessors for StatusState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusState = value ?? null; } + + /// Internal Acessors for StatusTotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsImported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsImported = value ?? default(long); } + + /// Internal Acessors for StatusTotalBlobsWalked + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusTotalBlobsWalked { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsWalked; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsWalked = value ?? default(long); } + + /// Internal Acessors for StatusTotalConflict + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalConflict; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalConflict = value ?? default(int); } + + /// Internal Acessors for StatusTotalError + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal.StatusTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalError; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalError = value ?? default(int); } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Id = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name = value ?? null; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties _property; + + /// Properties of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobProperties()); set => this._property = value; } + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusBlobsImportedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsImportedPerSecond; } + + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusBlobsWalkedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusBlobsWalkedPerSecond; } + + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedDirectory; } + + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedFile; } + + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusImportedSymlink; } + + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastCompletionTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastCompletionTime; } + + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastStartedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusLastStartedTime; } + + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusMessage; } + + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingDirectory; } + + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingFile; } + + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusPreexistingSymlink; } + + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusState; } + + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsImported; } + + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalBlobsWalked { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalBlobsWalked; } + + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalConflict; } + + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)Property).StatusTotalError; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public ImportJob() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + public partial interface IImportJob : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResource + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.", + SerializedName = @"importPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ImportPrefix { get; set; } + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(int) })] + int? MaximumError { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of total files, directories, and symlinks imported per second.", + SerializedName = @"blobsImportedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? StatusBlobsImportedPerSecond { get; } + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of blobs walked per second.", + SerializedName = @"blobsWalkedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? StatusBlobsWalkedPerSecond { get; } + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified directories that have been imported into the filesystem.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedDirectory { get; } + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified files that have been imported into the filesystem.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedFile { get; } + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Newly added symbolic links into the filesystem.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedSymlink { get; } + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed import job.", + SerializedName = @"lastCompletionTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastCompletionTime { get; } + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest import job started.", + SerializedName = @"lastStartedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastStartedTime { get; } + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status message of the import job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Directories that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingDirectory { get; } + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingFile { get; } + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Symbolic links that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingSymlink { get; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string StatusState { get; } + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blobs that have been imported since import began.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalBlobsImported { get; } + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blob objects walked.", + SerializedName = @"totalBlobsWalked", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalBlobsWalked { get; } + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of conflicts in the import job.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(int) })] + int? StatusTotalConflict { get; } + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of errors in the import job.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(int) })] + int? StatusTotalError { get; } + + } + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + internal partial interface IImportJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceInternal + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + + string AzureAsyncOperation { get; set; } + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + System.Collections.Generic.List ImportPrefix { get; set; } + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + int? MaximumError { get; set; } + /// Properties of the import job. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties Property { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the import + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus Status { get; set; } + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + long? StatusBlobsImportedPerSecond { get; set; } + /// A recent and frequently updated rate of blobs walked per second. + long? StatusBlobsWalkedPerSecond { get; set; } + /// New or modified directories that have been imported into the filesystem. + long? StatusImportedDirectory { get; set; } + /// New or modified files that have been imported into the filesystem. + long? StatusImportedFile { get; set; } + /// Newly added symbolic links into the filesystem. + long? StatusImportedSymlink { get; set; } + /// The time (in UTC) of the last completed import job. + global::System.DateTime? StatusLastCompletionTime { get; set; } + /// The time (in UTC) the latest import job started. + global::System.DateTime? StatusLastStartedTime { get; set; } + /// The status message of the import job. + string StatusMessage { get; set; } + /// Directories that already exist in the filesystem and have not been modified. + long? StatusPreexistingDirectory { get; set; } + /// Files that already exist in the filesystem and have not been modified. + long? StatusPreexistingFile { get; set; } + /// Symbolic links that already exist in the filesystem and have not been modified. + long? StatusPreexistingSymlink { get; set; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string StatusState { get; set; } + /// The total blobs that have been imported since import began. + long? StatusTotalBlobsImported { get; set; } + /// The total blob objects walked. + long? StatusTotalBlobsWalked { get; set; } + /// Number of conflicts in the import job. + int? StatusTotalConflict { get; set; } + /// Number of errors in the import job. + int? StatusTotalError { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.json.cs new file mode 100644 index 000000000000..68b227a3c06f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJob.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + public partial class ImportJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJob(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.PowerShell.cs new file mode 100644 index 000000000000..abdc3473c19c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.PowerShell.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Properties of the import job. + [System.ComponentModel.TypeConverter(typeof(ImportJobPropertiesTypeConverter))] + public partial class ImportJobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("ImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).MaximumError = (int?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).MaximumError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsWalked = (long?) content.GetValueForProperty("StatusTotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsWalkedPerSecond = (long?) content.GetValueForProperty("StatusBlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsImported = (long?) content.GetValueForProperty("StatusTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedFile = (long?) content.GetValueForProperty("StatusImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedDirectory = (long?) content.GetValueForProperty("StatusImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedSymlink = (long?) content.GetValueForProperty("StatusImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingFile = (long?) content.GetValueForProperty("StatusPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingDirectory = (long?) content.GetValueForProperty("StatusPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingSymlink = (long?) content.GetValueForProperty("StatusPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsImportedPerSecond = (long?) content.GetValueForProperty("StatusBlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastStartedTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalError = (int?) content.GetValueForProperty("StatusTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalConflict = (int?) content.GetValueForProperty("StatusTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + if (content.Contains("ImportPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ImportPrefix = (System.Collections.Generic.List) content.GetValueForProperty("ImportPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ImportPrefix, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ConflictResolutionMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ConflictResolutionMode = (string) content.GetValueForProperty("ConflictResolutionMode",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).ConflictResolutionMode, global::System.Convert.ToString); + } + if (content.Contains("MaximumError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).MaximumError = (int?) content.GetValueForProperty("MaximumError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).MaximumError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusState = (string) content.GetValueForProperty("StatusState",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusState, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsWalked = (long?) content.GetValueForProperty("StatusTotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsWalkedPerSecond = (long?) content.GetValueForProperty("StatusBlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusTotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsImported = (long?) content.GetValueForProperty("StatusTotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedFile = (long?) content.GetValueForProperty("StatusImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedDirectory = (long?) content.GetValueForProperty("StatusImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedSymlink = (long?) content.GetValueForProperty("StatusImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingFile = (long?) content.GetValueForProperty("StatusPreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingDirectory = (long?) content.GetValueForProperty("StatusPreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusPreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingSymlink = (long?) content.GetValueForProperty("StatusPreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusPreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusBlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsImportedPerSecond = (long?) content.GetValueForProperty("StatusBlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusBlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusLastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusLastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastStartedTime = (global::System.DateTime?) content.GetValueForProperty("StatusLastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusLastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("StatusTotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalError = (int?) content.GetValueForProperty("StatusTotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StatusTotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalConflict = (int?) content.GetValueForProperty("StatusTotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal)this).StatusTotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Properties of the import job. + [System.ComponentModel.TypeConverter(typeof(ImportJobPropertiesTypeConverter))] + public partial interface IImportJobProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.TypeConverter.cs new file mode 100644 index 000000000000..1fb4cb1e5285 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.cs new file mode 100644 index 000000000000..787ecabaf67a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.cs @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the import job. + public partial class ImportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Backing field for property. + private string _conflictResolutionMode; + + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ConflictResolutionMode { get => this._conflictResolutionMode; set => this._conflictResolutionMode = value; } + + /// Backing field for property. + private System.Collections.Generic.List _importPrefix; + + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List ImportPrefix { get => this._importPrefix; set => this._importPrefix = value; } + + /// Backing field for property. + private int? _maximumError; + + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public int? MaximumError { get => this._maximumError; set => this._maximumError = value; } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusBlobsImportedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusBlobsImportedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsImportedPerSecond; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsImportedPerSecond = value ?? default(long); } + + /// Internal Acessors for StatusBlobsWalkedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusBlobsWalkedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsWalkedPerSecond; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsWalkedPerSecond = value ?? default(long); } + + /// Internal Acessors for StatusImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedDirectory = value ?? default(long); } + + /// Internal Acessors for StatusImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedFile = value ?? default(long); } + + /// Internal Acessors for StatusImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedSymlink = value ?? default(long); } + + /// Internal Acessors for StatusLastCompletionTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusLastCompletionTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastCompletionTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastCompletionTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusLastStartedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusLastStartedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastStartedTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastStartedTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).StatusMessage = value ?? null; } + + /// Internal Acessors for StatusPreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingDirectory; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingDirectory = value ?? default(long); } + + /// Internal Acessors for StatusPreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingFile = value ?? default(long); } + + /// Internal Acessors for StatusPreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingSymlink; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingSymlink = value ?? default(long); } + + /// Internal Acessors for StatusState + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).State = value ?? null; } + + /// Internal Acessors for StatusTotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsImported; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsImported = value ?? default(long); } + + /// Internal Acessors for StatusTotalBlobsWalked + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusTotalBlobsWalked { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsWalked; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsWalked = value ?? default(long); } + + /// Internal Acessors for StatusTotalConflict + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalConflict; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalConflict = value ?? default(int); } + + /// Internal Acessors for StatusTotalError + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesInternal.StatusTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalError; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalError = value ?? default(int); } + + /// Backing field for property. + private string _provisioningState; + + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus _status; + + /// The status of the import + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatus()); } + + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusBlobsImportedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsImportedPerSecond; } + + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusBlobsWalkedPerSecond { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).BlobsWalkedPerSecond; } + + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedDirectory; } + + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedFile; } + + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusImportedSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).ImportedSymlink; } + + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastCompletionTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastCompletionTime; } + + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusLastStartedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).LastStartedTime; } + + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).StatusMessage; } + + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingDirectory { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingDirectory; } + + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingFile; } + + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusPreexistingSymlink { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).PreexistingSymlink; } + + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string StatusState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).State; } + + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalBlobsImported { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsImported; } + + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public long? StatusTotalBlobsWalked { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalBlobsWalked; } + + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusTotalConflict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalConflict; } + + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public int? StatusTotalError { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)Status).TotalError; } + + /// Creates an new instance. + public ImportJobProperties() + { + + } + } + /// Properties of the import job. + public partial interface IImportJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.", + SerializedName = @"importPrefixes", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ImportPrefix { get; set; } + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(int) })] + int? MaximumError { get; set; } + /// ARM provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"ARM provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; } + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of total files, directories, and symlinks imported per second.", + SerializedName = @"blobsImportedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? StatusBlobsImportedPerSecond { get; } + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of blobs walked per second.", + SerializedName = @"blobsWalkedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? StatusBlobsWalkedPerSecond { get; } + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified directories that have been imported into the filesystem.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedDirectory { get; } + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified files that have been imported into the filesystem.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedFile { get; } + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Newly added symbolic links into the filesystem.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? StatusImportedSymlink { get; } + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed import job.", + SerializedName = @"lastCompletionTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastCompletionTime { get; } + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest import job started.", + SerializedName = @"lastStartedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusLastStartedTime { get; } + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status message of the import job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Directories that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingDirectory { get; } + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingFile { get; } + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Symbolic links that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? StatusPreexistingSymlink { get; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string StatusState { get; } + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blobs that have been imported since import began.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalBlobsImported { get; } + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blob objects walked.", + SerializedName = @"totalBlobsWalked", + PossibleTypes = new [] { typeof(long) })] + long? StatusTotalBlobsWalked { get; } + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of conflicts in the import job.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(int) })] + int? StatusTotalConflict { get; } + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of errors in the import job.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(int) })] + int? StatusTotalError { get; } + + } + /// Properties of the import job. + internal partial interface IImportJobPropertiesInternal + + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + string ConflictResolutionMode { get; set; } + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + System.Collections.Generic.List ImportPrefix { get; set; } + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + int? MaximumError { get; set; } + /// ARM provisioning state. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Succeeded", "Failed", "Creating", "Deleting", "Updating", "Canceled")] + string ProvisioningState { get; set; } + /// The status of the import + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus Status { get; set; } + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + long? StatusBlobsImportedPerSecond { get; set; } + /// A recent and frequently updated rate of blobs walked per second. + long? StatusBlobsWalkedPerSecond { get; set; } + /// New or modified directories that have been imported into the filesystem. + long? StatusImportedDirectory { get; set; } + /// New or modified files that have been imported into the filesystem. + long? StatusImportedFile { get; set; } + /// Newly added symbolic links into the filesystem. + long? StatusImportedSymlink { get; set; } + /// The time (in UTC) of the last completed import job. + global::System.DateTime? StatusLastCompletionTime { get; set; } + /// The time (in UTC) the latest import job started. + global::System.DateTime? StatusLastStartedTime { get; set; } + /// The status message of the import job. + string StatusMessage { get; set; } + /// Directories that already exist in the filesystem and have not been modified. + long? StatusPreexistingDirectory { get; set; } + /// Files that already exist in the filesystem and have not been modified. + long? StatusPreexistingFile { get; set; } + /// Symbolic links that already exist in the filesystem and have not been modified. + long? StatusPreexistingSymlink { get; set; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string StatusState { get; set; } + /// The total blobs that have been imported since import began. + long? StatusTotalBlobsImported { get; set; } + /// The total blob objects walked. + long? StatusTotalBlobsWalked { get; set; } + /// Number of conflicts in the import job. + int? StatusTotalConflict { get; set; } + /// Number of errors in the import job. + int? StatusTotalError { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.json.cs new file mode 100644 index 000000000000..2eb2c84b5bce --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobProperties.json.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Properties of the import job. + public partial class ImportJobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobPropertiesStatus.FromJson(__jsonStatus) : _status;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + {_importPrefix = If( json?.PropertyT("importPrefixes"), out var __jsonImportPrefixes) ? If( __jsonImportPrefixes as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _importPrefix;} + {_conflictResolutionMode = If( json?.PropertyT("conflictResolutionMode"), out var __jsonConflictResolutionMode) ? (string)__jsonConflictResolutionMode : (string)_conflictResolutionMode;} + {_maximumError = If( json?.PropertyT("maximumErrors"), out var __jsonMaximumErrors) ? (int?)__jsonMaximumErrors : _maximumError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + if (null != this._importPrefix) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._importPrefix ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("importPrefixes",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._conflictResolutionMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._conflictResolutionMode.ToString()) : null, "conflictResolutionMode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._maximumError ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((int)this._maximumError) : null, "maximumErrors" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.PowerShell.cs new file mode 100644 index 000000000000..67507c548bc6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// The status of the import + [System.ComponentModel.TypeConverter(typeof(ImportJobPropertiesStatusTypeConverter))] + public partial class ImportJobPropertiesStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobPropertiesStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobPropertiesStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobPropertiesStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("TotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsWalked = (long?) content.GetValueForProperty("TotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsWalkedPerSecond = (long?) content.GetValueForProperty("BlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsImportedPerSecond = (long?) content.GetValueForProperty("BlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastStartedTime = (global::System.DateTime?) content.GetValueForProperty("LastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalError = (int?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalConflict = (int?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobPropertiesStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("TotalBlobsWalked")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsWalked = (long?) content.GetValueForProperty("TotalBlobsWalked",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsWalked, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobsWalkedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsWalkedPerSecond = (long?) content.GetValueForProperty("BlobsWalkedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsWalkedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBlobsImported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsImported = (long?) content.GetValueForProperty("TotalBlobsImported",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalBlobsImported, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedFile = (long?) content.GetValueForProperty("ImportedFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedDirectory = (long?) content.GetValueForProperty("ImportedDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ImportedSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedSymlink = (long?) content.GetValueForProperty("ImportedSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).ImportedSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingFile = (long?) content.GetValueForProperty("PreexistingFile",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingFile, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingDirectory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingDirectory = (long?) content.GetValueForProperty("PreexistingDirectory",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingDirectory, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PreexistingSymlink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingSymlink = (long?) content.GetValueForProperty("PreexistingSymlink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).PreexistingSymlink, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("BlobsImportedPerSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsImportedPerSecond = (long?) content.GetValueForProperty("BlobsImportedPerSecond",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).BlobsImportedPerSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastCompletionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastCompletionTime = (global::System.DateTime?) content.GetValueForProperty("LastCompletionTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastCompletionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastStartedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastStartedTime = (global::System.DateTime?) content.GetValueForProperty("LastStartedTime",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).LastStartedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalError = (int?) content.GetValueForProperty("TotalError",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalError, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TotalConflict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalConflict = (int?) content.GetValueForProperty("TotalConflict",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal)this).TotalConflict, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The status of the import + [System.ComponentModel.TypeConverter(typeof(ImportJobPropertiesStatusTypeConverter))] + public partial interface IImportJobPropertiesStatus + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.TypeConverter.cs new file mode 100644 index 000000000000..ccbcc7f37927 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobPropertiesStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobPropertiesStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobPropertiesStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobPropertiesStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.cs new file mode 100644 index 000000000000..14e8485c5d61 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the import + public partial class ImportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal + { + + /// Backing field for property. + private long? _blobsImportedPerSecond; + + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? BlobsImportedPerSecond { get => this._blobsImportedPerSecond; } + + /// Backing field for property. + private long? _blobsWalkedPerSecond; + + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? BlobsWalkedPerSecond { get => this._blobsWalkedPerSecond; } + + /// Backing field for property. + private long? _importedDirectory; + + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedDirectory { get => this._importedDirectory; } + + /// Backing field for property. + private long? _importedFile; + + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedFile { get => this._importedFile; } + + /// Backing field for property. + private long? _importedSymlink; + + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? ImportedSymlink { get => this._importedSymlink; } + + /// Backing field for property. + private global::System.DateTime? _lastCompletionTime; + + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastCompletionTime { get => this._lastCompletionTime; } + + /// Backing field for property. + private global::System.DateTime? _lastStartedTime; + + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public global::System.DateTime? LastStartedTime { get => this._lastStartedTime; } + + /// Internal Acessors for BlobsImportedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.BlobsImportedPerSecond { get => this._blobsImportedPerSecond; set { {_blobsImportedPerSecond = value;} } } + + /// Internal Acessors for BlobsWalkedPerSecond + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.BlobsWalkedPerSecond { get => this._blobsWalkedPerSecond; set { {_blobsWalkedPerSecond = value;} } } + + /// Internal Acessors for ImportedDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.ImportedDirectory { get => this._importedDirectory; set { {_importedDirectory = value;} } } + + /// Internal Acessors for ImportedFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.ImportedFile { get => this._importedFile; set { {_importedFile = value;} } } + + /// Internal Acessors for ImportedSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.ImportedSymlink { get => this._importedSymlink; set { {_importedSymlink = value;} } } + + /// Internal Acessors for LastCompletionTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.LastCompletionTime { get => this._lastCompletionTime; set { {_lastCompletionTime = value;} } } + + /// Internal Acessors for LastStartedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.LastStartedTime { get => this._lastStartedTime; set { {_lastStartedTime = value;} } } + + /// Internal Acessors for PreexistingDirectory + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.PreexistingDirectory { get => this._preexistingDirectory; set { {_preexistingDirectory = value;} } } + + /// Internal Acessors for PreexistingFile + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.PreexistingFile { get => this._preexistingFile; set { {_preexistingFile = value;} } } + + /// Internal Acessors for PreexistingSymlink + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.PreexistingSymlink { get => this._preexistingSymlink; set { {_preexistingSymlink = value;} } } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for StatusMessage + string Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.StatusMessage { get => this._statusMessage; set { {_statusMessage = value;} } } + + /// Internal Acessors for TotalBlobsImported + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.TotalBlobsImported { get => this._totalBlobsImported; set { {_totalBlobsImported = value;} } } + + /// Internal Acessors for TotalBlobsWalked + long? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.TotalBlobsWalked { get => this._totalBlobsWalked; set { {_totalBlobsWalked = value;} } } + + /// Internal Acessors for TotalConflict + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.TotalConflict { get => this._totalConflict; set { {_totalConflict = value;} } } + + /// Internal Acessors for TotalError + int? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatusInternal.TotalError { get => this._totalError; set { {_totalError = value;} } } + + /// Backing field for property. + private long? _preexistingDirectory; + + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingDirectory { get => this._preexistingDirectory; } + + /// Backing field for property. + private long? _preexistingFile; + + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingFile { get => this._preexistingFile; } + + /// Backing field for property. + private long? _preexistingSymlink; + + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? PreexistingSymlink { get => this._preexistingSymlink; } + + /// Backing field for property. + private string _state; + + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string State { get => this._state; } + + /// Backing field for property. + private string _statusMessage; + + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string StatusMessage { get => this._statusMessage; } + + /// Backing field for property. + private long? _totalBlobsImported; + + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalBlobsImported { get => this._totalBlobsImported; } + + /// Backing field for property. + private long? _totalBlobsWalked; + + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public long? TotalBlobsWalked { get => this._totalBlobsWalked; } + + /// Backing field for property. + private int? _totalConflict; + + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public int? TotalConflict { get => this._totalConflict; } + + /// Backing field for property. + private int? _totalError; + + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public int? TotalError { get => this._totalError; } + + /// Creates an new instance. + public ImportJobPropertiesStatus() + { + + } + } + /// The status of the import + public partial interface IImportJobPropertiesStatus : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of total files, directories, and symlinks imported per second.", + SerializedName = @"blobsImportedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? BlobsImportedPerSecond { get; } + /// A recent and frequently updated rate of blobs walked per second. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A recent and frequently updated rate of blobs walked per second.", + SerializedName = @"blobsWalkedPerSecond", + PossibleTypes = new [] { typeof(long) })] + long? BlobsWalkedPerSecond { get; } + /// New or modified directories that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified directories that have been imported into the filesystem.", + SerializedName = @"importedDirectories", + PossibleTypes = new [] { typeof(long) })] + long? ImportedDirectory { get; } + /// New or modified files that have been imported into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"New or modified files that have been imported into the filesystem.", + SerializedName = @"importedFiles", + PossibleTypes = new [] { typeof(long) })] + long? ImportedFile { get; } + /// Newly added symbolic links into the filesystem. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Newly added symbolic links into the filesystem.", + SerializedName = @"importedSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? ImportedSymlink { get; } + /// The time (in UTC) of the last completed import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) of the last completed import job.", + SerializedName = @"lastCompletionTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastCompletionTime { get; } + /// The time (in UTC) the latest import job started. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The time (in UTC) the latest import job started.", + SerializedName = @"lastStartedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStartedTime { get; } + /// Directories that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Directories that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingDirectories", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingDirectory { get; } + /// Files that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Files that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingFiles", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingFile { get; } + /// Symbolic links that already exist in the filesystem and have not been modified. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Symbolic links that already exist in the filesystem and have not been modified.", + SerializedName = @"preexistingSymlinks", + PossibleTypes = new [] { typeof(long) })] + long? PreexistingSymlink { get; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string State { get; } + /// The status message of the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status message of the import job.", + SerializedName = @"statusMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; } + /// The total blobs that have been imported since import began. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blobs that have been imported since import began.", + SerializedName = @"totalBlobsImported", + PossibleTypes = new [] { typeof(long) })] + long? TotalBlobsImported { get; } + /// The total blob objects walked. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The total blob objects walked.", + SerializedName = @"totalBlobsWalked", + PossibleTypes = new [] { typeof(long) })] + long? TotalBlobsWalked { get; } + /// Number of conflicts in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of conflicts in the import job.", + SerializedName = @"totalConflicts", + PossibleTypes = new [] { typeof(int) })] + int? TotalConflict { get; } + /// Number of errors in the import job. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of errors in the import job.", + SerializedName = @"totalErrors", + PossibleTypes = new [] { typeof(int) })] + int? TotalError { get; } + + } + /// The status of the import + internal partial interface IImportJobPropertiesStatusInternal + + { + /// + /// A recent and frequently updated rate of total files, directories, and symlinks imported per second. + /// + long? BlobsImportedPerSecond { get; set; } + /// A recent and frequently updated rate of blobs walked per second. + long? BlobsWalkedPerSecond { get; set; } + /// New or modified directories that have been imported into the filesystem. + long? ImportedDirectory { get; set; } + /// New or modified files that have been imported into the filesystem. + long? ImportedFile { get; set; } + /// Newly added symbolic links into the filesystem. + long? ImportedSymlink { get; set; } + /// The time (in UTC) of the last completed import job. + global::System.DateTime? LastCompletionTime { get; set; } + /// The time (in UTC) the latest import job started. + global::System.DateTime? LastStartedTime { get; set; } + /// Directories that already exist in the filesystem and have not been modified. + long? PreexistingDirectory { get; set; } + /// Files that already exist in the filesystem and have not been modified. + long? PreexistingFile { get; set; } + /// Symbolic links that already exist in the filesystem and have not been modified. + long? PreexistingSymlink { get; set; } + /// + /// The operational state of the import job. InProgress indicates the import is still running. Canceled indicates it has been + /// canceled by the user. Completed indicates import finished, successfully importing all discovered blobs into the Lustre + /// namespace. CompletedPartial indicates the import finished but some blobs either were found to be conflicting and could + /// not be imported or other errors were encountered. Failed means the import was unable to complete due to a fatal error. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("InProgress", "Cancelling", "Canceled", "Completed", "CompletedPartial", "Failed")] + string State { get; set; } + /// The status message of the import job. + string StatusMessage { get; set; } + /// The total blobs that have been imported since import began. + long? TotalBlobsImported { get; set; } + /// The total blob objects walked. + long? TotalBlobsWalked { get; set; } + /// Number of conflicts in the import job. + int? TotalConflict { get; set; } + /// Number of errors in the import job. + int? TotalError { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.json.cs new file mode 100644 index 000000000000..aa33180c4554 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobPropertiesStatus.json.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// The status of the import + public partial class ImportJobPropertiesStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobPropertiesStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobPropertiesStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobPropertiesStatus(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + {_statusMessage = If( json?.PropertyT("statusMessage"), out var __jsonStatusMessage) ? (string)__jsonStatusMessage : (string)_statusMessage;} + {_totalBlobsWalked = If( json?.PropertyT("totalBlobsWalked"), out var __jsonTotalBlobsWalked) ? (long?)__jsonTotalBlobsWalked : _totalBlobsWalked;} + {_blobsWalkedPerSecond = If( json?.PropertyT("blobsWalkedPerSecond"), out var __jsonBlobsWalkedPerSecond) ? (long?)__jsonBlobsWalkedPerSecond : _blobsWalkedPerSecond;} + {_totalBlobsImported = If( json?.PropertyT("totalBlobsImported"), out var __jsonTotalBlobsImported) ? (long?)__jsonTotalBlobsImported : _totalBlobsImported;} + {_importedFile = If( json?.PropertyT("importedFiles"), out var __jsonImportedFiles) ? (long?)__jsonImportedFiles : _importedFile;} + {_importedDirectory = If( json?.PropertyT("importedDirectories"), out var __jsonImportedDirectories) ? (long?)__jsonImportedDirectories : _importedDirectory;} + {_importedSymlink = If( json?.PropertyT("importedSymlinks"), out var __jsonImportedSymlinks) ? (long?)__jsonImportedSymlinks : _importedSymlink;} + {_preexistingFile = If( json?.PropertyT("preexistingFiles"), out var __jsonPreexistingFiles) ? (long?)__jsonPreexistingFiles : _preexistingFile;} + {_preexistingDirectory = If( json?.PropertyT("preexistingDirectories"), out var __jsonPreexistingDirectories) ? (long?)__jsonPreexistingDirectories : _preexistingDirectory;} + {_preexistingSymlink = If( json?.PropertyT("preexistingSymlinks"), out var __jsonPreexistingSymlinks) ? (long?)__jsonPreexistingSymlinks : _preexistingSymlink;} + {_blobsImportedPerSecond = If( json?.PropertyT("blobsImportedPerSecond"), out var __jsonBlobsImportedPerSecond) ? (long?)__jsonBlobsImportedPerSecond : _blobsImportedPerSecond;} + {_lastCompletionTime = If( json?.PropertyT("lastCompletionTime"), out var __jsonLastCompletionTime) ? global::System.DateTime.TryParse((string)__jsonLastCompletionTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastCompletionTimeValue) ? __jsonLastCompletionTimeValue : _lastCompletionTime : _lastCompletionTime;} + {_lastStartedTime = If( json?.PropertyT("lastStartedTime"), out var __jsonLastStartedTime) ? global::System.DateTime.TryParse((string)__jsonLastStartedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastStartedTimeValue) ? __jsonLastStartedTimeValue : _lastStartedTime : _lastStartedTime;} + {_totalError = If( json?.PropertyT("totalErrors"), out var __jsonTotalErrors) ? (int?)__jsonTotalErrors : _totalError;} + {_totalConflict = If( json?.PropertyT("totalConflicts"), out var __jsonTotalConflicts) ? (int?)__jsonTotalConflicts : _totalConflict;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._statusMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._statusMessage.ToString()) : null, "statusMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBlobsWalked ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalBlobsWalked) : null, "totalBlobsWalked" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._blobsWalkedPerSecond ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._blobsWalkedPerSecond) : null, "blobsWalkedPerSecond" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBlobsImported ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._totalBlobsImported) : null, "totalBlobsImported" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedFile) : null, "importedFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedDirectory) : null, "importedDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._importedSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._importedSymlink) : null, "importedSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingFile ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingFile) : null, "preexistingFiles" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingDirectory ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingDirectory) : null, "preexistingDirectories" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._preexistingSymlink ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._preexistingSymlink) : null, "preexistingSymlinks" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._blobsImportedPerSecond ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((long)this._blobsImportedPerSecond) : null, "blobsImportedPerSecond" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastCompletionTime ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastCompletionTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastCompletionTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastStartedTime ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._lastStartedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastStartedTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalError ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((int)this._totalError) : null, "totalErrors" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalConflict ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNumber((int)this._totalConflict) : null, "totalConflicts" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.PowerShell.cs new file mode 100644 index 000000000000..a34b76386c4a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// An import job update instance. + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdateTypeConverter))] + public partial class ImportJobUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// An import job update instance. + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdateTypeConverter))] + public partial interface IImportJobUpdate + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.TypeConverter.cs new file mode 100644 index 000000000000..8de6db00147e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.cs new file mode 100644 index 000000000000..19dd99848dab --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An import job update instance. + public partial class ImportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal + { + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Inlined)] + public string AdminStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)Property).AdminStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)Property).AdminStatus = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties _property; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags _tag; + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public ImportJobUpdate() + { + + } + } + /// An import job update instance. + public partial interface IImportJobUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get; set; } + + } + /// An import job update instance. + internal partial interface IImportJobUpdateInternal + + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties Property { get; set; } + /// Resource tags. + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.json.cs new file mode 100644 index 000000000000..3d66e622b0a1 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdate.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// An import job update instance. + public partial class ImportJobUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobUpdate(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateProperties.FromJson(__jsonProperties) : _property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTags.FromJson(__jsonTags) : _tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..9d5b2ade8c1e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdatePropertiesTypeConverter))] + public partial class ImportJobUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdminStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)this).AdminStatus = (string) content.GetValueForProperty("AdminStatus",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal)this).AdminStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdatePropertiesTypeConverter))] + public partial interface IImportJobUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..30667bd17d1d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.cs new file mode 100644 index 000000000000..818f2544e077 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class ImportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdatePropertiesInternal + { + + /// Backing field for property. + private string _adminStatus; + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AdminStatus { get => this._adminStatus; set => this._adminStatus = value; } + + /// Creates an new instance. + public ImportJobUpdateProperties() + { + + } + } + public partial interface IImportJobUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + + } + internal partial interface IImportJobUpdatePropertiesInternal + + { + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + string AdminStatus { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.json.cs new file mode 100644 index 000000000000..3aeb95b57de7 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateProperties.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class ImportJobUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobUpdateProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_adminStatus = If( json?.PropertyT("adminStatus"), out var __jsonAdminStatus) ? (string)__jsonAdminStatus : (string)_adminStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._adminStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._adminStatus.ToString()) : null, "adminStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..33722e5e3e33 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdateTagsTypeConverter))] + public partial class ImportJobUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(ImportJobUpdateTagsTypeConverter))] + public partial interface IImportJobUpdateTags + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..41184aead9ce --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.cs new file mode 100644 index 000000000000..a9a9b7b64975 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class ImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTagsInternal + { + + /// Creates an new instance. + public ImportJobUpdateTags() + { + + } + } + /// Resource tags. + public partial interface IImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + + } + /// Resource tags. + internal partial interface IImportJobUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.dictionary.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.dictionary.cs new file mode 100644 index 000000000000..f3f1c636813f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class ImportJobUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.json.cs new file mode 100644 index 000000000000..073da8c19639 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobUpdateTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// Resource tags. + public partial class ImportJobUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobUpdateTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ImportJobUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.PowerShell.cs new file mode 100644 index 000000000000..261077669b24 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + /// + [System.ComponentModel.TypeConverter(typeof(ImportJobsListResultTypeConverter))] + public partial class ImportJobsListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobsListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobsListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobsListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobsListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + [System.ComponentModel.TypeConverter(typeof(ImportJobsListResultTypeConverter))] + public partial interface IImportJobsListResult + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.TypeConverter.cs new file mode 100644 index 000000000000..c354fd040fb6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobsListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobsListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobsListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobsListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.cs new file mode 100644 index 000000000000..15f36206c730 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + /// + public partial class ImportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of import job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// List of import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ImportJobsListResult() + { + + } + } + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + public partial interface IImportJobsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IJsonSerializable + { + /// URL to get the next set of import job list results, if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of import job list results, if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// List of import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of import jobs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob) })] + System.Collections.Generic.List Value { get; set; } + + } + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + internal partial interface IImportJobsListResultInternal + + { + /// URL to get the next set of import job list results, if there are any. + string NextLink { get; set; } + /// List of import jobs. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.json.cs new file mode 100644 index 000000000000..8d35bc711f18 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsListResult.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + /// + /// Result of the request to list import jobs. It contains a list of import jobs and a URL link to get the next set of results. + /// + public partial class ImportJobsListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobsListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobsListResult(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob) (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(__u) )) ))() : null : _value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs new file mode 100644 index 000000000000..f08dcb49ba98 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.PowerShell.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ImportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial class ImportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportJobsUpdateAcceptedResponseHeaders(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportJobsUpdateAcceptedResponseHeaders(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportJobsUpdateAcceptedResponseHeaders(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureAsyncOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = (string) content.GetValueForProperty("AzureAsyncOperation",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(ImportJobsUpdateAcceptedResponseHeadersTypeConverter))] + public partial interface IImportJobsUpdateAcceptedResponseHeaders + + { + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs new file mode 100644 index 000000000000..a40585372aff --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportJobsUpdateAcceptedResponseHeadersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportJobsUpdateAcceptedResponseHeaders.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportJobsUpdateAcceptedResponseHeaders.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportJobsUpdateAcceptedResponseHeaders.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.cs new file mode 100644 index 000000000000..7a771d46578b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class ImportJobsUpdateAcceptedResponseHeaders : + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable + { + + /// Backing field for property. + private string _azureAsyncOperation; + + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AzureAsyncOperation { get => this._azureAsyncOperation; set => this._azureAsyncOperation = value; } + + /// Creates an new instance. + public ImportJobsUpdateAcceptedResponseHeaders() + { + + } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("azure-async-operation", out var __azureAsyncOperationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeadersInternal)this).AzureAsyncOperation = System.Linq.Enumerable.FirstOrDefault(__azureAsyncOperationHeader0) is string __headerAzureAsyncOperationHeader0 ? __headerAzureAsyncOperationHeader0 : (string)null; + } + } + } + public partial interface IImportJobsUpdateAcceptedResponseHeaders + + { + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"azure-async-operation", + PossibleTypes = new [] { typeof(string) })] + string AzureAsyncOperation { get; set; } + + } + internal partial interface IImportJobsUpdateAcceptedResponseHeadersInternal + + { + string AzureAsyncOperation { get; set; } + + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.json.cs new file mode 100644 index 000000000000..cd47a222ec91 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/ImportJobsUpdateAcceptedResponseHeaders.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + + public partial class ImportJobsUpdateAcceptedResponseHeaders + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsUpdateAcceptedResponseHeaders FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json ? new ImportJobsUpdateAcceptedResponseHeaders(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject instance to deserialize from. + internal ImportJobsUpdateAcceptedResponseHeaders(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.PowerShell.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.PowerShell.cs index a57f8b6448f5..226aba91c951 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.PowerShell.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.PowerShell.cs @@ -120,6 +120,18 @@ internal StorageCacheIdentity(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AmlFilesystemName = (string) content.GetValueForProperty("AmlFilesystemName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AmlFilesystemName, global::System.Convert.ToString); } + if (content.Contains("AutoExportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoExportJobName = (string) content.GetValueForProperty("AutoExportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoExportJobName, global::System.Convert.ToString); + } + if (content.Contains("ImportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).ImportJobName = (string) content.GetValueForProperty("ImportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).ImportJobName, global::System.Convert.ToString); + } + if (content.Contains("AutoImportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoImportJobName = (string) content.GetValueForProperty("AutoImportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoImportJobName, global::System.Convert.ToString); + } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).Id, global::System.Convert.ToString); @@ -153,6 +165,18 @@ internal StorageCacheIdentity(global::System.Management.Automation.PSObject cont { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AmlFilesystemName = (string) content.GetValueForProperty("AmlFilesystemName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AmlFilesystemName, global::System.Convert.ToString); } + if (content.Contains("AutoExportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoExportJobName = (string) content.GetValueForProperty("AutoExportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoExportJobName, global::System.Convert.ToString); + } + if (content.Contains("ImportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).ImportJobName = (string) content.GetValueForProperty("ImportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).ImportJobName, global::System.Convert.ToString); + } + if (content.Contains("AutoImportJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoImportJobName = (string) content.GetValueForProperty("AutoImportJobName",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).AutoImportJobName, global::System.Convert.ToString); + } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentityInternal)this).Id, global::System.Convert.ToString); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.cs index c834c1b77512..38477925ed60 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.cs @@ -21,6 +21,24 @@ public partial class StorageCacheIdentity : [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + /// Backing field for property. + private string _autoExportJobName; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AutoExportJobName { get => this._autoExportJobName; set => this._autoExportJobName = value; } + + /// Backing field for property. + private string _autoImportJobName; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string AutoImportJobName { get => this._autoImportJobName; set => this._autoImportJobName = value; } + /// Backing field for property. private string _id; @@ -28,6 +46,15 @@ public partial class StorageCacheIdentity : [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] public string Id { get => this._id; set => this._id = value; } + /// Backing field for property. + private string _importJobName; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Origin(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PropertyOrigin.Owned)] + public string ImportJobName { get => this._importJobName; set => this._importJobName = value; } + /// Backing field for property. private string _resourceGroupName; @@ -64,6 +91,32 @@ public partial interface IStorageCacheIdentity : SerializedName = @"amlFilesystemName", PossibleTypes = new [] { typeof(string) })] string AmlFilesystemName { get; set; } + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + string AutoExportJobName { get; set; } + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + string AutoImportJobName { get; set; } /// Resource identity path [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -75,6 +128,19 @@ public partial interface IStorageCacheIdentity : SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] string Id { get; set; } + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + string ImportJobName { get; set; } /// The name of the resource group. The name is case insensitive. [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, @@ -106,8 +172,20 @@ internal partial interface IStorageCacheIdentityInternal /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. /// string AmlFilesystemName { get; set; } + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + string AutoExportJobName { get; set; } + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + string AutoImportJobName { get; set; } /// Resource identity path string Id { get; set; } + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + string ImportJobName { get; set; } /// The name of the resource group. The name is case insensitive. string ResourceGroupName { get; set; } /// The ID of the target subscription. diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.json.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.json.cs index 1ab4d9b365d5..efb2cccdab27 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.json.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/Models/StorageCacheIdentity.json.cs @@ -79,6 +79,9 @@ internal StorageCacheIdentity(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Ru {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} {_amlFilesystemName = If( json?.PropertyT("amlFilesystemName"), out var __jsonAmlFilesystemName) ? (string)__jsonAmlFilesystemName : (string)_amlFilesystemName;} + {_autoExportJobName = If( json?.PropertyT("autoExportJobName"), out var __jsonAutoExportJobName) ? (string)__jsonAutoExportJobName : (string)_autoExportJobName;} + {_importJobName = If( json?.PropertyT("importJobName"), out var __jsonImportJobName) ? (string)__jsonImportJobName : (string)_importJobName;} + {_autoImportJobName = If( json?.PropertyT("autoImportJobName"), out var __jsonAutoImportJobName) ? (string)__jsonAutoImportJobName : (string)_autoImportJobName;} {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } @@ -105,6 +108,9 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode ToJ AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); AddIf( null != (((object)this._amlFilesystemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._amlFilesystemName.ToString()) : null, "amlFilesystemName" ,container.Add ); + AddIf( null != (((object)this._autoExportJobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._autoExportJobName.ToString()) : null, "autoExportJobName" ,container.Add ); + AddIf( null != (((object)this._importJobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._importJobName.ToString()) : null, "importJobName" ,container.Add ); + AddIf( null != (((object)this._autoImportJobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._autoImportJobName.ToString()) : null, "autoImportJobName" ,container.Add ); AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); AfterToJson(ref container); return container; diff --git a/generated/StorageCache/StorageCache.Autorest/generated/api/StorageCache.cs b/generated/StorageCache/StorageCache.Autorest/generated/api/StorageCache.cs index 9dba3b7af7ae..83db6cec808e 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/api/StorageCache.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/api/StorageCache.cs @@ -32,7 +32,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsArchive(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemArchiveInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -80,7 +80,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsArchiveViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemArchiveInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -142,7 +142,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsArchiveViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -272,7 +272,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCancelArchive(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -314,7 +314,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCancelArchiveViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -452,7 +452,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -500,7 +500,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -558,7 +558,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -619,7 +619,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -666,7 +666,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -715,7 +715,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1092,7 +1092,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsDelete(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1134,7 +1134,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1368,7 +1368,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsGet(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1409,7 +1409,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1460,7 +1460,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1514,7 +1514,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsGetWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1693,7 +1693,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1732,7 +1732,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1772,7 +1772,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1821,7 +1821,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1871,7 +1871,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2045,7 +2045,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2091,7 +2091,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2137,7 +2137,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsListWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2309,7 +2309,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2357,7 +2357,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2415,7 +2415,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2476,7 +2476,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2523,7 +2523,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2572,7 +2572,7 @@ public partial class StorageCache /// public async global::System.Threading.Tasks.Task AmlFilesystemsUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2931,9 +2931,15 @@ public partial class StorageCache } } - /// Check that subnets will be valid for AML file system check calls. + /// update an auto export job. /// The ID of the target subscription. - /// Information about the subnets to validate. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2943,9 +2949,9 @@ public partial class StorageCache /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task CheckAmlFsSubnets(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2953,7 +2959,12 @@ public partial class StorageCache var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2962,7 +2973,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -2971,13 +2982,14 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); + await this.AutoExportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Check that subnets will be valid for AML file system check calls. + /// update an auto export job. /// - /// Information about the subnets to validate. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2987,27 +2999,35 @@ public partial class StorageCache /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task CheckAmlFsSubnetsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3016,7 +3036,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -3025,141 +3045,90 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); + await this.AutoExportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Check that subnets will be valid for AML file system check calls. - /// The ID of the target subscription. - /// Json string supplied to the CheckAmlFsSubnets operation - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// update an auto export job. + /// + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task CheckAmlFsSubnetsViaJsonString(string subscriptionId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); - } - } - - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task CheckAmlFsSubnets_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) - { - using( NoSynchronizationContext ) - { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } - } - } - - /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. - /// - /// The ID of the target subscription. - /// Information about the subnets to validate. - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task CheckAmlFsSubnets_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + return await this.AutoExportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// + /// update an auto export job. /// The ID of the target subscription. - /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoExportJobsCreateOrUpdate operation /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3167,7 +3136,12 @@ public partial class StorageCache var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3176,108 +3150,102 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + await this.AutoExportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// - /// - /// Information to determine the number of available IPs a subnet will need to host the AML file system. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// update an auto export job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoExportJobsCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + return await this.AutoExportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// - /// - /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// update an auto export job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3286,7 +3254,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -3295,34 +3263,6794 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + return await this.AutoExportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); } } /// - /// Get the number of available IP addresses needed for the AML file system information provided. + /// Actual wire call for method. /// - /// The ID of the target subscription. - /// Json string supplied to the GetRequiredAmlFsSubnetsSize operation - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaJsonString(string subscriptionId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; - // Constant Parameters + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoExportJobName),autoExportJobName); + await eventListener.AssertMinimumLength(nameof(autoExportJobName),autoExportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoExportJobName),autoExportJobName,80); + await eventListener.AssertRegEx(nameof(autoExportJobName), autoExportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Schedules an auto export job for deletion. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsDelete(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Schedules an auto export job for deletion. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsDelete_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoExportJobName),autoExportJobName); + await eventListener.AssertMinimumLength(nameof(autoExportJobName),autoExportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoExportJobName),autoExportJobName,80); + await eventListener.AssertRegEx(nameof(autoExportJobName), autoExportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// Returns an auto export job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsGet(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an auto export job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an auto export job. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns an auto export job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsGetWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsGet_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoExportJobName),autoExportJobName); + await eventListener.AssertMinimumLength(nameof(autoExportJobName),autoExportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoExportJobName),autoExportJobName,80); + await eventListener.AssertRegEx(nameof(autoExportJobName), autoExportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// + /// Returns all the auto export jobs the user has access to under an AML File System. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystem(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns all the auto export jobs the user has access to under an AML File System. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystemViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns all the auto export jobs the user has access to under an AML File System. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystemViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns all the auto export jobs the user has access to under an AML File System. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystemWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystemWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystem_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsListByAmlFilesystem_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// update an auto export job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto export job instance. + /// + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto export job instance. + /// + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoExportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoExportJobName = _match.Groups["autoExportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoExportJobs/" + + autoExportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto export job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoExportJobsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoExportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto export job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoExportJobsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto export job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoExportJobsUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoExportJobs/" + + global::System.Uri.EscapeDataString(autoExportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoExportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto export job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoExportJobsUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoExportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoExportJobName),autoExportJobName); + await eventListener.AssertMinimumLength(nameof(autoExportJobName),autoExportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoExportJobName),autoExportJobName,80); + await eventListener.AssertRegEx(nameof(autoExportJobName), autoExportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// update an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job. + /// + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job. + /// + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoImportJobsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoImportJobsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoImportJobName),autoImportJobName); + await eventListener.AssertMinimumLength(nameof(autoImportJobName),autoImportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoImportJobName),autoImportJobName,80); + await eventListener.AssertRegEx(nameof(autoImportJobName), autoImportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Schedules an auto import job for deletion. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsDelete(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Schedules an auto import job for deletion. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsDelete_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoImportJobName),autoImportJobName); + await eventListener.AssertMinimumLength(nameof(autoImportJobName),autoImportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoImportJobName),autoImportJobName,80); + await eventListener.AssertRegEx(nameof(autoImportJobName), autoImportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// Returns an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsGet(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an auto import job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an auto import job. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns an auto import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsGetWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsGet_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoImportJobName),autoImportJobName); + await eventListener.AssertMinimumLength(nameof(autoImportJobName),autoImportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoImportJobName),autoImportJobName,80); + await eventListener.AssertRegEx(nameof(autoImportJobName), autoImportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// + /// Returns all the auto import jobs the user has access to under an AML File System. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystem(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns all the auto import jobs the user has access to under an AML File System. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystemViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns all the auto import jobs the user has access to under an AML File System. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystemViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Returns all the auto import jobs the user has access to under an AML File System. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystemWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystemWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystem_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsListByAmlFilesystem_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// update an auto import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job instance. + /// + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job instance. + /// + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/autoImportJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var autoImportJobName = _match.Groups["autoImportJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/autoImportJobs/" + + autoImportJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoImportJobsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AutoImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an auto import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Json string supplied to the AutoImportJobsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an auto import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AutoImportJobsUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/autoImportJobs/" + + global::System.Uri.EscapeDataString(autoImportJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.AutoImportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Object containing the user-selectable properties of the auto import job. If read-only properties are + /// included, they must match the existing values of those properties. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AutoImportJobsUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string autoImportJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(autoImportJobName),autoImportJobName); + await eventListener.AssertMinimumLength(nameof(autoImportJobName),autoImportJobName,2); + await eventListener.AssertMaximumLength(nameof(autoImportJobName),autoImportJobName,80); + await eventListener.AssertRegEx(nameof(autoImportJobName), autoImportJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Check that subnets will be valid for AML file system check calls. + /// The ID of the target subscription. + /// Information about the subnets to validate. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckAmlFsSubnets(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Check that subnets will be valid for AML file system check calls. + /// + /// Information about the subnets to validate. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckAmlFsSubnetsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Check that subnets will be valid for AML file system check calls. + /// The ID of the target subscription. + /// Json string supplied to the CheckAmlFsSubnets operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckAmlFsSubnetsViaJsonString(string subscriptionId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/checkAmlFSSubnets" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckAmlFsSubnets_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CheckAmlFsSubnets_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// Information about the subnets to validate. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CheckAmlFsSubnets_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystemSubnetInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// The ID of the target subscription. + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.StorageCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// The ID of the target subscription. + /// Json string supplied to the GetRequiredAmlFsSubnetsSize operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaJsonString(string subscriptionId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// The ID of the target subscription. + /// Json string supplied to the GetRequiredAmlFsSubnetsSize operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaJsonStringWithResult(string subscriptionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// The ID of the target subscription. + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.RequiredAmlFilesystemSubnetsSize.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.RequiredAmlFilesystemSubnetsSize.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// update an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an import job. + /// + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an import job. + /// + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Json string supplied to the ImportJobsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Json string supplied to the ImportJobsCreateOrUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(importJobName),importJobName); + await eventListener.AssertMinimumLength(nameof(importJobName),importJobName,2); + await eventListener.AssertMaximumLength(nameof(importJobName),importJobName,80); + await eventListener.AssertRegEx(nameof(importJobName), importJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Schedules an import job for deletion. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsDelete(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Schedules an import job for deletion. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsDelete_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(importJobName),importJobName); + await eventListener.AssertMinimumLength(nameof(importJobName),importJobName,2); + await eventListener.AssertMaximumLength(nameof(importJobName),importJobName,80); + await eventListener.AssertRegEx(nameof(importJobName), importJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// Returns an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsGet(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an import job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns an import job. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Returns an import job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsGetWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsGet_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(importJobName),importJobName); + await eventListener.AssertMinimumLength(nameof(importJobName),importJobName,2); + await eventListener.AssertMaximumLength(nameof(importJobName),importJobName,80); + await eventListener.AssertRegEx(nameof(importJobName), importJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// Returns all import jobs the user has access to under an AML File System. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystem(string subscriptionId, string resourceGroupName, string amlFilesystemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns all import jobs the user has access to under an AML File System. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystemViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsListByAmlFilesystem_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Returns all import jobs the user has access to under an AML File System. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystemViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// Returns all import jobs the user has access to under an AML File System. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystemWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsListByAmlFilesystemWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystemWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystem_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ImportJobsListByAmlFilesystem_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + } + } + + /// update an import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsUpdate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an import job instance. + /// + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an import job instance. + /// + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.StorageCache/amlFilesystems/(?[^/]+)/importJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var amlFilesystemName = _match.Groups["amlFilesystemName"].Value; + var importJobName = _match.Groups["importJobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + amlFilesystemName + + "/importJobs/" + + importJobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ImportJobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an import job instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Json string supplied to the ImportJobsUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ImportJobsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3331,7 +10059,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -3340,24 +10068,27 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.GetRequiredAmlFsSubnetsSize_Call (request, onOk,onDefault,eventListener,sender); + await this.ImportJobsUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// + /// update an import job instance. /// The ID of the target subscription. - /// Json string supplied to the GetRequiredAmlFsSubnetsSize operation + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Json string supplied to the ImportJobsUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeViaJsonStringWithResult(string subscriptionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ImportJobsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3365,7 +10096,12 @@ public partial class StorageCache var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3374,7 +10110,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -3383,25 +10119,29 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + return await this.ImportJobsUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// + /// update an import job instance. /// The ID of the target subscription. - /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ImportJobsUpdateWithResult(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2023-05-01"; + var apiVersion = @"2025-07-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3409,7 +10149,12 @@ public partial class StorageCache var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize" + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.StorageCache/amlFilesystems/" + + global::System.Uri.EscapeDataString(amlFilesystemName) + + "/importJobs/" + + global::System.Uri.EscapeDataString(importJobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3418,7 +10163,7 @@ public partial class StorageCache // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -3427,31 +10172,121 @@ public partial class StorageCache request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.GetRequiredAmlFsSubnetsSizeWithResult_Call (request, eventListener,sender); + return await this.ImportJobsUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSizeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ImportJobsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -3460,20 +10295,20 @@ public partial class StorageCache case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.RequiredAmlFilesystemSubnetsSize.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); return await _result; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) ); // Error Response : default var code = (await _result)?.Code; var message = (await _result)?.Message; if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(_response, await _result); throw ex; } else @@ -3493,7 +10328,7 @@ public partial class StorageCache } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -3503,17 +10338,109 @@ public partial class StorageCache /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ImportJobsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -3522,13 +10449,13 @@ public partial class StorageCache case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.RequiredAmlFilesystemSubnetsSize.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.CloudError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -3544,21 +10471,38 @@ public partial class StorageCache } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. - /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// The name of the resource group. The name is case insensitive. + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and + /// end with alphanumeric. + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with + /// alphanumeric. + /// Object containing the user-selectable properties of the import job. If read-only properties are included, + /// they must match the existing values of those properties. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task GetRequiredAmlFsSubnetsSize_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSizeInfo body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ImportJobsUpdate_Validate(string subscriptionId, string resourceGroupName, string amlFilesystemName, string importJobName, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(amlFilesystemName),amlFilesystemName); + await eventListener.AssertMinimumLength(nameof(amlFilesystemName),amlFilesystemName,2); + await eventListener.AssertMaximumLength(nameof(amlFilesystemName),amlFilesystemName,80); + await eventListener.AssertRegEx(nameof(amlFilesystemName), amlFilesystemName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); + await eventListener.AssertNotNull(nameof(importJobName),importJobName); + await eventListener.AssertMinimumLength(nameof(importJobName),importJobName,2); + await eventListener.AssertMaximumLength(nameof(importJobName),importJobName,80); + await eventListener.AssertRegEx(nameof(importJobName), importJobName, @"^[0-9a-zA-Z][-0-9a-zA-Z_]{0,78}[0-9a-zA-Z]$"); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystemSubnetRequiredSize_GetExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystemSubnetRequiredSize_GetExpanded.cs index 2f780412825e..ceae56f2c711 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystemSubnetRequiredSize_GetExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystemSubnetRequiredSize_GetExpanded.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IRequiredAmlFilesystemSubnetsSize))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Get the number of available IP addresses needed for the AML file system information provided.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize", ApiVersion = "2025-07-01")] public partial class GetAzStorageCacheAmlFileSystemSubnetRequiredSize_GetExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_Get.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_Get.cs index 1e3f7593e933..71a834ce4a15 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_Get.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_Get.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class GetAzStorageCacheAmlFileSystem_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_GetViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_GetViaIdentity.cs index f9014295e0fb..f5ea2e55ddf0 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_GetViaIdentity.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_GetViaIdentity.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class GetAzStorageCacheAmlFileSystem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List.cs index de3693d75843..c1dcf4698cae 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns all AML file systems the user has access to under a subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems", ApiVersion = "2025-07-01")] public partial class GetAzStorageCacheAmlFileSystem_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List1.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List1.cs index 3a39fbd7b44d..269c1e710b61 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List1.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAmlFileSystem_List1.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns all AML file systems the user has access to under a resource group.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems", ApiVersion = "2025-07-01")] public partial class GetAzStorageCacheAmlFileSystem_List1 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_Get.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_Get.cs new file mode 100644 index 000000000000..55c7dd145af8 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_Get.cs @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto export job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoExportJob_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoExportJob_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoExportJob_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsGet(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentity.cs new file mode 100644 index 000000000000..fee4b992434f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentity.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto export job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoExportJob_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoExportJob_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoExportJob_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoExportJobsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoExportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoExportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoExportJobsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoExportJobName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..95a3520288ec --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto export job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoExportJob_GetViaIdentityAmlFilesystem() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoExportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoExportJobsGetViaIdentity(AmlFilesystemInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoExportJobsGet(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_List.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_List.cs new file mode 100644 index 000000000000..dc3d338c9d6f --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoExportJob_List.cs @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// + /// Returns all the auto export jobs the user has access to under an AML File System. + /// + /// + /// [OpenAPI] ListByAmlFilesystem=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoExportJob_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns all the auto export jobs the user has access to under an AML File System.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoExportJob_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoExportJob_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsListByAmlFilesystem(SubscriptionId, ResourceGroupName, AmlFilesystemName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobsListResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsListByAmlFilesystem_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_Get.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_Get.cs new file mode 100644 index 000000000000..2ef2b7a9d9d2 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_Get.cs @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoImportJob_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoImportJob_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoImportJob_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsGet(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentity.cs new file mode 100644 index 000000000000..dd191ebacc00 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentity.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoImportJob_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoImportJob_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoImportJob_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoImportJobsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoImportJobsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoImportJobName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..6034bfe2b5e7 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an auto import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoImportJob_GetViaIdentityAmlFilesystem() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoImportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoImportJobsGetViaIdentity(AmlFilesystemInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoImportJobsGet(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_List.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_List.cs new file mode 100644 index 000000000000..747548a7fe3d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheAutoImportJob_List.cs @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// + /// Returns all the auto import jobs the user has access to under an AML File System. + /// + /// + /// [OpenAPI] ListByAmlFilesystem=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheAutoImportJob_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns all the auto import jobs the user has access to under an AML File System.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheAutoImportJob_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheAutoImportJob_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsListByAmlFilesystem(SubscriptionId, ResourceGroupName, AmlFilesystemName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobsListResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsListByAmlFilesystem_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_Get.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_Get.cs new file mode 100644 index 000000000000..a8cb13f99945 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_Get.cs @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheImportJob_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheImportJob_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheImportJob_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsGet(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentity.cs new file mode 100644 index 000000000000..e88b07062cda --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentity.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheImportJob_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheImportJob_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheImportJob_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ImportJobsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ImportJobsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.ImportJobName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..813afa5382c5 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns an import job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheImportJob_GetViaIdentityAmlFilesystem")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheImportJob_GetViaIdentityAmlFilesystem() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/importJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.ImportJobsGetViaIdentity(AmlFilesystemInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.ImportJobsGet(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_List.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_List.cs new file mode 100644 index 000000000000..61351c0a6377 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/GetAzStorageCacheImportJob_List.cs @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Returns all import jobs the user has access to under an AML File System. + /// + /// [OpenAPI] ListByAmlFilesystem=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStorageCacheImportJob_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Returns all import jobs the user has access to under an AML File System.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs", ApiVersion = "2025-07-01")] + public partial class GetAzStorageCacheImportJob_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzStorageCacheImportJob_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsListByAmlFilesystem(SubscriptionId, ResourceGroupName, AmlFilesystemName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ICloudError + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobsListResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsListByAmlFilesystem_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveExpanded.cs index abffb4fad0af..110826bc61db 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Archive data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2025-07-01")] public partial class InvokeAzStorageCacheAmlFileSystemArchive_ArchiveExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -502,7 +502,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded.cs index e4eeedb6db05..12db8c3b46df 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Archive data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2025-07-01")] public partial class InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -482,7 +482,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath.cs index d57c700fcf02..d28141213f41 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Archive data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonFilePath : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -503,7 +503,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString.cs index 616e4df139a4..5292458bef4d 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Archive data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/archive", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class InvokeAzStorageCacheAmlFileSystemArchive_ArchiveViaJsonString : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -501,7 +501,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateExpanded.cs index 6a5bbdda98a9..d16038e1effa 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class NewAzStorageCacheAmlFileSystem_CreateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -45,15 +45,6 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateExpanded : global::Sys /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -229,6 +220,55 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateExpanded : global::Sys [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + public string RootSquashSettingMode { get => _amlFilesystemBody.RootSquashSettingMode ?? null; set => _amlFilesystemBody.RootSquashSettingMode = value; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + public string RootSquashSettingNoSquashNidList { get => _amlFilesystemBody.RootSquashSettingNoSquashNidList ?? null; set => _amlFilesystemBody.RootSquashSettingNoSquashNidList = value; } + + /// Group ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Group ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashGid { get => _amlFilesystemBody.RootSquashSettingSquashGid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashGid = value; } + + /// User ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "User ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashUid { get => _amlFilesystemBody.RootSquashSettingSquashUid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashUid = value; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. @@ -244,18 +284,36 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateExpanded : global::Sys public string SettingContainer { get => _amlFilesystemBody.SettingContainer ?? null; set => _amlFilesystemBody.SettingContainer = value; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, ReadOnly = false, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] public string SettingImportPrefix { get => _amlFilesystemBody.SettingImportPrefix ?? null; set => _amlFilesystemBody.SettingImportPrefix = value; } + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + public string[] SettingImportPrefixesInitial { get => _amlFilesystemBody.SettingImportPrefixesInitial?.ToArray() ?? null /* fixedArrayOf */; set => _amlFilesystemBody.SettingImportPrefixesInitial = (value != null ? new System.Collections.Generic.List(value) : null); } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the @@ -426,11 +484,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCache /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -772,24 +825,7 @@ protected override void StopProcessing() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded.cs index 8e425df185d2..5616dbe15826 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -45,15 +45,6 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded : /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -206,6 +197,55 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded : [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + public string RootSquashSettingMode { get => _amlFilesystemBody.RootSquashSettingMode ?? null; set => _amlFilesystemBody.RootSquashSettingMode = value; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + public string RootSquashSettingNoSquashNidList { get => _amlFilesystemBody.RootSquashSettingNoSquashNidList ?? null; set => _amlFilesystemBody.RootSquashSettingNoSquashNidList = value; } + + /// Group ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Group ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashGid { get => _amlFilesystemBody.RootSquashSettingSquashGid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashGid = value; } + + /// User ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "User ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashUid { get => _amlFilesystemBody.RootSquashSettingSquashUid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashUid = value; } + /// /// Resource ID of storage container used for hydrating the namespace and archiving from the namespace. The resource provider /// must have permission to create SAS tokens on the storage account. @@ -221,18 +261,36 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateViaIdentityExpanded : public string SettingContainer { get => _amlFilesystemBody.SettingContainer ?? null; set => _amlFilesystemBody.SettingContainer = value; } /// - /// Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace. + /// Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This + /// is only used during initial creation of the AML file system. It automatically creates an import job resource that can + /// be deleted. /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( Required = false, ReadOnly = false, - Description = @"Only blobs in the non-logging container that start with this path/prefix get hydrated into the cluster namespace.", + Description = @"Only blobs in the non-logging container that start with this path/prefix get imported into the cluster namespace. This is only used during initial creation of the AML file system. It automatically creates an import job resource that can be deleted.", SerializedName = @"importPrefix", PossibleTypes = new [] { typeof(string) })] public string SettingImportPrefix { get => _amlFilesystemBody.SettingImportPrefix ?? null; set => _amlFilesystemBody.SettingImportPrefix = value; } + /// + /// Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the + /// cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. + /// It automatically creates an import job resource that can be deleted. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Only blobs in the non-logging container that start with one of the paths/prefixes in this array get imported into the cluster namespace. This is only used during initial creation of the AML file system and has '/' as the default value. It automatically creates an import job resource that can be deleted.", + SerializedName = @"importPrefixesInitial", + PossibleTypes = new [] { typeof(string) })] + public string[] SettingImportPrefixesInitial { get => _amlFilesystemBody.SettingImportPrefixesInitial?.ToArray() ?? null /* fixedArrayOf */; set => _amlFilesystemBody.SettingImportPrefixesInitial = (value != null ? new System.Collections.Generic.List(value) : null); } + /// /// Resource ID of storage container used for logging events and errors. Must be a separate container in the same storage /// account as the hydration and archive container. The resource provider must have permission to create SAS tokens on the @@ -383,11 +441,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCache /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -750,24 +803,7 @@ protected override void StopProcessing() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath.cs index c0ce03a5dcaa..87d0674bc9cb 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -41,17 +41,8 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateViaJsonFilePath : glob /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - public global::System.String _jsonString; - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -265,11 +256,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCache /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -585,24 +571,7 @@ protected override void StopProcessing() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonString.cs index 5f0a1058da17..029a5d258e33 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonString.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAmlFileSystem_CreateViaJsonString.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class NewAzStorageCacheAmlFileSystem_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -41,15 +41,6 @@ public partial class NewAzStorageCacheAmlFileSystem_CreateViaJsonString : global /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -263,11 +254,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCache /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -583,24 +569,7 @@ protected override void StopProcessing() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateExpanded.cs new file mode 100644 index 000000000000..2ad6c4557056 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateExpanded.cs @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto export job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoExportJob_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoExportJob_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.", + SerializedName = @"autoExportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoExportPrefix { get => _autoExportJobBody.AutoExportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoExportJobBody.AutoExportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoExportJobBody.Location ?? null; set => _autoExportJobBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoExportJob_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoExportJob_CreateExpanded Clone() + { + var clone = new NewAzStorageCacheAutoExportJob_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoExportJob_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsCreateOrUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..88c8616f03ef --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,617 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto export job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.", + SerializedName = @"autoExportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoExportPrefix { get => _autoExportJobBody.AutoExportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoExportJobBody.AutoExportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoExportJobBody.Location ?? null; set => _autoExportJobBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public NewAzStorageCacheAutoExportJob_CreateViaIdentityAmlFilesystemExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoExportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoExportJobsCreateOrUpdateViaIdentity(AmlFilesystemInputObject.Id, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoExportJobsCreateOrUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..a50e339352c3 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded.cs @@ -0,0 +1,601 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto export job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoExportJob_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto export job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths for now is 1. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto exported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths for now is 1.", + SerializedName = @"autoExportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoExportPrefix { get => _autoExportJobBody.AutoExportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoExportJobBody.AutoExportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoExportJobBody.Location ?? null; set => _autoExportJobBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoExportJob_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoExportJobsCreateOrUpdateViaIdentity(InputObject.Id, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoExportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoExportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoExportJobsCreateOrUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoExportJobName ?? null, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..aa58d0ea2d8c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto export job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoExportJob_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath Clone() + { + var clone = new NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoExportJob_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonString.cs new file mode 100644 index 000000000000..d52927b2c732 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoExportJob_CreateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto export job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoExportJob_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto export job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheAutoExportJob_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoExportJob_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoExportJob_CreateViaJsonString Clone() + { + var clone = new NewAzStorageCacheAutoExportJob_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoExportJob_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateExpanded.cs new file mode 100644 index 000000000000..838f8dddeb41 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateExpanded.cs @@ -0,0 +1,684 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoImportJob_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoImportJob_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.", + SerializedName = @"autoImportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoImportPrefix { get => _autoImportJobBody.AutoImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoImportJobBody.AutoImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _autoImportJobBody.ConflictResolutionMode ?? null; set => _autoImportJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Whether or not to enable deletions during auto import. This only affects overwrite-dirty.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether or not to enable deletions during auto import. This only affects overwrite-dirty.", + SerializedName = @"enableDeletions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableDeletion { get => _autoImportJobBody.EnableDeletion ?? default(global::System.Management.Automation.SwitchParameter); set => _autoImportJobBody.EnableDeletion = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoImportJobBody.Location ?? null; set => _autoImportJobBody.Location = value; } + + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(long) })] + public long MaximumError { get => _autoImportJobBody.MaximumError ?? default(long); set => _autoImportJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoImportJob_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoImportJob_CreateExpanded Clone() + { + var clone = new NewAzStorageCacheAutoImportJob_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoImportJob_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsCreateOrUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..10efc315fe26 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,664 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.", + SerializedName = @"autoImportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoImportPrefix { get => _autoImportJobBody.AutoImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoImportJobBody.AutoImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _autoImportJobBody.ConflictResolutionMode ?? null; set => _autoImportJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Whether or not to enable deletions during auto import. This only affects overwrite-dirty.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether or not to enable deletions during auto import. This only affects overwrite-dirty.", + SerializedName = @"enableDeletions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableDeletion { get => _autoImportJobBody.EnableDeletion ?? default(global::System.Management.Automation.SwitchParameter); set => _autoImportJobBody.EnableDeletion = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoImportJobBody.Location ?? null; set => _autoImportJobBody.Location = value; } + + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(long) })] + public long MaximumError { get => _autoImportJobBody.MaximumError ?? default(long); set => _autoImportJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public NewAzStorageCacheAutoImportJob_CreateViaIdentityAmlFilesystemExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoImportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoImportJobsCreateOrUpdateViaIdentity(AmlFilesystemInputObject.Id, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoImportJobsCreateOrUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..0286b35c5ca4 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded.cs @@ -0,0 +1,648 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoImportJob_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// An auto import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJob(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number + /// of maximum allowed paths is 100. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get auto imported to the cluster namespace. It has '/' as the default value. Number of maximum allowed paths is 100.", + SerializedName = @"autoImportPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] AutoImportPrefix { get => _autoImportJobBody.AutoImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _autoImportJobBody.AutoImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, + /// but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not + /// do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto + /// import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. + /// OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please + /// reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a + /// thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the auto import job will handle conflicts. For example, if the auto import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the auto import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the auto import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or is currently released. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/blob-integration#conflict-resolution-mode for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _autoImportJobBody.ConflictResolutionMode ?? null; set => _autoImportJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Whether or not to enable deletions during auto import. This only affects overwrite-dirty. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Whether or not to enable deletions during auto import. This only affects overwrite-dirty.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether or not to enable deletions during auto import. This only affects overwrite-dirty.", + SerializedName = @"enableDeletions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableDeletion { get => _autoImportJobBody.EnableDeletion ?? default(global::System.Management.Automation.SwitchParameter); set => _autoImportJobBody.EnableDeletion = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _autoImportJobBody.Location ?? null; set => _autoImportJobBody.Location = value; } + + /// + /// Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. + /// 0 means exit immediately on any error. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict-oriented errors (e.g., OS errors) Import will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately on any error.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(long) })] + public long MaximumError { get => _autoImportJobBody.MaximumError ?? default(long); set => _autoImportJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoImportJob_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoImportJobsCreateOrUpdateViaIdentity(InputObject.Id, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoImportJobsCreateOrUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoImportJobName ?? null, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..29c3c287fa77 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoImportJob_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath Clone() + { + var clone = new NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoImportJob_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonString.cs new file mode 100644 index 000000000000..b94e8516ffb7 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheAutoImportJob_CreateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an auto import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheAutoImportJob_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an auto import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheAutoImportJob_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheAutoImportJob_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheAutoImportJob_CreateViaJsonString Clone() + { + var clone = new NewAzStorageCacheAutoImportJob_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheAutoImportJob_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateExpanded.cs new file mode 100644 index 000000000000..7c7240600cbb --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateExpanded.cs @@ -0,0 +1,669 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheImportJob_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheImportJob_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _importJobBody.ConflictResolutionMode ?? null; set => _importJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.", + SerializedName = @"importPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] ImportPrefix { get => _importJobBody.ImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _importJobBody.ImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _importJobBody.Location ?? null; set => _importJobBody.Location = value; } + + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(int) })] + public int MaximumError { get => _importJobBody.MaximumError ?? default(int); set => _importJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheImportJob_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheImportJob_CreateExpanded Clone() + { + var clone = new NewAzStorageCacheImportJob_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheImportJob_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsCreateOrUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..d4611d19d7c0 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,649 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _importJobBody.ConflictResolutionMode ?? null; set => _importJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.", + SerializedName = @"importPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] ImportPrefix { get => _importJobBody.ImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _importJobBody.ImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _importJobBody.Location ?? null; set => _importJobBody.Location = value; } + + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(int) })] + public int MaximumError { get => _importJobBody.MaximumError ?? default(int); set => _importJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public NewAzStorageCacheImportJob_CreateViaIdentityAmlFilesystemExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/importJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.ImportJobsCreateOrUpdateViaIdentity(AmlFilesystemInputObject.Id, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.ImportJobsCreateOrUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..06df1db32107 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaIdentityExpanded.cs @@ -0,0 +1,631 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheImportJob_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class NewAzStorageCacheImportJob_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// An import job instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md + /// + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJob(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. By default it is set to 'Active'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job. By default it is set to 'Active'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file + /// is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with + /// the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and + /// re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways + /// extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ + /// for a thorough explanation of these resolution modes. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the import job will handle conflicts. For example, if the import job is trying to bring in a directory, but a file is at that path, how it handles it. Fail indicates that the import job should stop immediately and not do anything with the conflict. Skip indicates that it should pass over the conflict. OverwriteIfDirty causes the import job to delete and re-import the file or directory if it is a conflicting type, is dirty, or was not previously imported. OverwriteAlways extends OverwriteIfDirty to include releasing files that had been restored but were not dirty. Please reference https://learn.microsoft.com/en-us/azure/azure-managed-lustre/ for a thorough explanation of these resolution modes.", + SerializedName = @"conflictResolutionMode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Fail", "Skip", "OverwriteIfDirty", "OverwriteAlways")] + public string ConflictResolutionMode { get => _importJobBody.ConflictResolutionMode ?? null; set => _importJobBody.ConflictResolutionMode = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of blob paths/prefixes that get imported into the cluster namespace. It has '/' as the default value.", + SerializedName = @"importPrefixes", + PossibleTypes = new [] { typeof(string) })] + public string[] ImportPrefix { get => _importJobBody.ImportPrefix?.ToArray() ?? null /* fixedArrayOf */; set => _importJobBody.ImportPrefix = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _importJobBody.Location ?? null; set => _importJobBody.Location = value; } + + /// + /// Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means + /// exit immediately and is the default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total non-conflict oriented errors the import job will tolerate before exiting with failure. -1 means infinite. 0 means exit immediately and is the default.", + SerializedName = @"maximumErrors", + PossibleTypes = new [] { typeof(int) })] + public int MaximumError { get => _importJobBody.MaximumError ?? default(int); set => _importJobBody.MaximumError = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ITrackedResourceTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheImportJob_CreateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheImportJob_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzStorageCacheImportJob_CreateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheImportJob_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ImportJobsCreateOrUpdateViaIdentity(InputObject.Id, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ImportJobsCreateOrUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.ImportJobName ?? null, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..38cb18884c3d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheImportJob_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheImportJob_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheImportJob_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheImportJob_CreateViaJsonFilePath Clone() + { + var clone = new NewAzStorageCacheImportJob_CreateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheImportJob_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonString.cs new file mode 100644 index 000000000000..22cd88ae7b32 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/NewAzStorageCacheImportJob_CreateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// create an import job. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStorageCacheImportJob_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"create an import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class NewAzStorageCacheImportJob_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStorageCacheImportJob_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.NewAzStorageCacheImportJob_CreateViaJsonString Clone() + { + var clone = new NewAzStorageCacheImportJob_CreateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzStorageCacheImportJob_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_Delete.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_Delete.cs index f265f4a91f66..f1e6d2511b69 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_Delete.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_Delete.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an AML file system for deletion.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class RemoveAzStorageCacheAmlFileSystem_Delete : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -40,15 +40,6 @@ public partial class RemoveAzStorageCacheAmlFileSystem_Delete : global::System.M /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -263,11 +254,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -579,7 +565,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } @@ -603,7 +589,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity.cs index 919d664d4998..29a985982390 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an AML file system for deletion.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -40,15 +40,6 @@ public partial class RemoveAzStorageCacheAmlFileSystem_DeleteViaIdentity : globa /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -218,11 +209,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -554,7 +540,7 @@ protected override void StopProcessing() return ; } // onNoContent - response for 204 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } @@ -578,7 +564,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_Delete.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_Delete.cs new file mode 100644 index 000000000000..50cdf1e49bc6 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_Delete.cs @@ -0,0 +1,616 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto export job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoExportJob_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto export job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoExportJob_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheAutoExportJob_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoExportJob_Delete Clone() + { + var clone = new RemoveAzStorageCacheAutoExportJob_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsDelete(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onNoContent, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheAutoExportJob_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity.cs new file mode 100644 index 000000000000..b6c12c921395 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto export job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoExportJob_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto export job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoExportJobsDeleteViaIdentity(InputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoExportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoExportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoExportJobsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoExportJobName ?? null, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheAutoExportJob_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..e8db6fcff58e --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem.cs @@ -0,0 +1,596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto export job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto export job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem Clone() + { + var clone = new RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoExportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoExportJobsDeleteViaIdentity(AmlFilesystemInputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoExportJobsDelete(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public RemoveAzStorageCacheAutoExportJob_DeleteViaIdentityAmlFilesystem() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_Delete.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_Delete.cs new file mode 100644 index 000000000000..12200ae6b636 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_Delete.cs @@ -0,0 +1,616 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoImportJob_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoImportJob_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheAutoImportJob_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoImportJob_Delete Clone() + { + var clone = new RemoveAzStorageCacheAutoImportJob_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsDelete(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onNoContent, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheAutoImportJob_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity.cs new file mode 100644 index 000000000000..514dfa616f11 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoImportJob_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoImportJobsDeleteViaIdentity(InputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoImportJobsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoImportJobName ?? null, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheAutoImportJob_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..dfd5e9dd3928 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem.cs @@ -0,0 +1,596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an auto import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an auto import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem Clone() + { + var clone = new RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoImportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoImportJobsDeleteViaIdentity(AmlFilesystemInputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoImportJobsDelete(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public RemoveAzStorageCacheAutoImportJob_DeleteViaIdentityAmlFilesystem() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_Delete.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_Delete.cs new file mode 100644 index 000000000000..acf3eaf27bec --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_Delete.cs @@ -0,0 +1,616 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheImportJob_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheImportJob_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheImportJob_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheImportJob_Delete Clone() + { + var clone = new RemoveAzStorageCacheImportJob_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsDelete(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, onNoContent, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheImportJob_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentity.cs new file mode 100644 index 000000000000..37174a84d400 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentity.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheImportJob_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheImportJob_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStorageCacheImportJob_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheImportJob_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStorageCacheImportJob_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ImportJobsDeleteViaIdentity(InputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ImportJobsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.ImportJobName ?? null, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheImportJob_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem.cs new file mode 100644 index 000000000000..56366b7eef54 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// Schedules an import job for deletion. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Schedules an import job for deletion.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem Clone() + { + var clone = new RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/importJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.ImportJobsDeleteViaIdentity(AmlFilesystemInputObject.Id, onNoContent, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.ImportJobsDelete(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, onNoContent, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzStorageCacheImportJob_DeleteViaIdentityAmlFilesystem() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_Cancel.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_Cancel.cs index c87fa16ee2dd..0456aac004d6 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_Cancel.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_Cancel.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Cancel archiving data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/cancelArchive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/cancelArchive", ApiVersion = "2025-07-01")] public partial class StopAzStorageCacheAmlFilesystemArchive_Cancel : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -486,7 +486,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_CancelViaIdentity.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_CancelViaIdentity.cs index e04b6da7296f..097d921e2d07 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_CancelViaIdentity.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/StopAzStorageCacheAmlFilesystemArchive_CancelViaIdentity.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Cancel archiving data from the AML file system.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/cancelArchive", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/cancelArchive", ApiVersion = "2025-07-01")] public partial class StopAzStorageCacheAmlFilesystemArchive_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -465,7 +465,7 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded.cs index 11067790272f..1220bd2ecb3e 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Check that subnets will be valid for AML file system check calls.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2025-07-01")] public partial class TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -508,7 +508,7 @@ public TestAzStorageCacheAmlFileSystemSubnet_CheckExpanded() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath.cs index ef9f34bd4a48..5b847cbcd7dc 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Check that subnets will be valid for AML file system check calls.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -472,7 +472,7 @@ public TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonFilePath() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString.cs index 45a39dcfac4e..f964c1b47af0 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"Check that subnets will be valid for AML file system check calls.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -470,7 +470,7 @@ public TestAzStorageCacheAmlFileSystemSubnet_CheckViaJsonString() return ; } // onOk - response for 200 / - if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateExpanded.cs index bb9166644f84..dfee3c7a07a1 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an AML file system instance.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class UpdateAzStorageCacheAmlFileSystem_UpdateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -43,15 +43,6 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateExpanded : global:: /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -198,6 +189,55 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateExpanded : global:: [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + public string RootSquashSettingMode { get => _amlFilesystemBody.RootSquashSettingMode ?? null; set => _amlFilesystemBody.RootSquashSettingMode = value; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + public string RootSquashSettingNoSquashNidList { get => _amlFilesystemBody.RootSquashSettingNoSquashNidList ?? null; set => _amlFilesystemBody.RootSquashSettingNoSquashNidList = value; } + + /// Group ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Group ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashGid { get => _amlFilesystemBody.RootSquashSettingSquashGid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashGid = value; } + + /// User ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "User ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashUid { get => _amlFilesystemBody.RootSquashSettingSquashUid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashUid = value; } + /// Resource Id. [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource Id.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] @@ -309,11 +349,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -629,24 +664,7 @@ public UpdateAzStorageCacheAmlFileSystem_UpdateExpanded() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded.cs index f34bb275ec43..9cc3973aa802 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an AML file system instance.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext @@ -43,15 +43,6 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -175,6 +166,55 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// + /// Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all + /// users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the + /// root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Squash mode of the AML file system. 'All': User and Group IDs on files will be squashed to the provided values for all users on non-trusted systems. 'RootOnly': User and Group IDs on files will be squashed to provided values for solely the root user on non-trusted systems. 'None': No squashing of User and Group IDs is performed for any users on any systems.", + SerializedName = @"mode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("None", "RootOnly", "All")] + public string RootSquashSettingMode { get => _amlFilesystemBody.RootSquashSettingMode ?? null; set => _amlFilesystemBody.RootSquashSettingMode = value; } + + /// Semicolon separated NID IP Address list(s) to be added to the TrustedSystems. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Semicolon separated NID IP Address list(s) to be added to the TrustedSystems.", + SerializedName = @"noSquashNidLists", + PossibleTypes = new [] { typeof(string) })] + public string RootSquashSettingNoSquashNidList { get => _amlFilesystemBody.RootSquashSettingNoSquashNidList ?? null; set => _amlFilesystemBody.RootSquashSettingNoSquashNidList = value; } + + /// Group ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Group ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Group ID to squash to.", + SerializedName = @"squashGID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashGid { get => _amlFilesystemBody.RootSquashSettingSquashGid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashGid = value; } + + /// User ID to squash to. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "User ID to squash to.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"User ID to squash to.", + SerializedName = @"squashUID", + PossibleTypes = new [] { typeof(long) })] + public long RootSquashSettingSquashUid { get => _amlFilesystemBody.RootSquashSettingSquashUid ?? default(long); set => _amlFilesystemBody.RootSquashSettingSquashUid = value; } + /// Resource Id. [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource Id.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] @@ -266,11 +306,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -606,24 +641,7 @@ public UpdateAzStorageCacheAmlFileSystem_UpdateViaIdentityExpanded() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath.cs index c5c481e6097b..f23388674753 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an AML file system instance.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -41,17 +41,8 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath : g /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - public global::System.String _jsonString; - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -265,11 +256,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -585,24 +571,7 @@ public UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonFilePath() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString.cs index d82a879abfe9..97c02ddbc045 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem))] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an AML file system instance.")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2023-05-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}", ApiVersion = "2025-07-01")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, @@ -41,15 +41,6 @@ public partial class UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString : glo /// A dictionary to carry over additional data for pipeline. private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - /// when specified, runs this cmdlet as a PowerShell job [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] @@ -263,11 +254,6 @@ public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCa /// Performs clean-up after the command execution protected override void EndProcessing() { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -583,24 +569,7 @@ public UpdateAzStorageCacheAmlFileSystem_UpdateViaJsonString() // onOk - response for 200 / application/json // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAmlFilesystem var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } + WriteObject(result, false); } } } diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateExpanded.cs new file mode 100644 index 000000000000..b7196df6f3df --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateExpanded.cs @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto export job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoExportJob_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto export job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoExportJob_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto export job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoExportJob_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoExportJob_UpdateExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoExportJob_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoExportJob_UpdateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..53232e2c6d85 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,589 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto export job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto export job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto export job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoExportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoExportJobsUpdateViaIdentity(AmlFilesystemInputObject.Id, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoExportJobsUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityAmlFilesystemExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..efa97f7a162b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded.cs @@ -0,0 +1,573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto export job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoExportJob_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto export job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto export job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdate _autoExportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoExportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto export job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto export job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto export job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoExportJobBody.AdminStatus ?? null; set => _autoExportJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJobUpdateTags Tag { get => _autoExportJobBody.Tag ?? null /* object */; set => _autoExportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoExportJobBody = this._autoExportJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoExportJobsUpdateViaIdentity(InputObject.Id, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoExportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoExportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoExportJobsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoExportJobName ?? null, _autoExportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoExportJob_UpdateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..ec3cba0b620d --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto export job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoExportJob_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto export job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath Clone() + { + var clone = new UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoExportJob_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString.cs new file mode 100644 index 000000000000..b5722ed36a0b --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto export job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoExportJob_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto export job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoExportJobs/{autoExportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto export job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoExportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoExportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString Clone() + { + var clone = new UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoExportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoExportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoExportJob_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoExportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateExpanded.cs new file mode 100644 index 000000000000..2f3344dc3357 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateExpanded.cs @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoImportJob_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoImportJob_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoImportJob_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoImportJob_UpdateExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoImportJob_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoImportJob_UpdateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..5dcdab6d60ba --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,589 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/autoImportJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.AutoImportJobsUpdateViaIdentity(AmlFilesystemInputObject.Id, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.AutoImportJobsUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityAmlFilesystemExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..7a2ab1903308 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded.cs @@ -0,0 +1,573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoImportJob_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// An auto import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdate _autoImportJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.AutoImportJobUpdate(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// + /// The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' + /// will disable the current active auto import job. By default it is set to 'Enable'. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the auto import job. Possible values: 'Enable', 'Disable'. Passing in a value of 'Disable' will disable the current active auto import job. By default it is set to 'Enable'.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Enable", "Disable")] + public string AdminStatus { get => _autoImportJobBody.AdminStatus ?? null; set => _autoImportJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJobUpdateTags Tag { get => _autoImportJobBody.Tag ?? null /* object */; set => _autoImportJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._autoImportJobBody = this._autoImportJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.AutoImportJobsUpdateViaIdentity(InputObject.Id, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AutoImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AutoImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.AutoImportJobsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.AutoImportJobName ?? null, _autoImportJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoImportJob_UpdateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..697d811970d3 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoImportJob_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath Clone() + { + var clone = new UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoImportJob_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString.cs new file mode 100644 index 000000000000..f3679ead4432 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an auto import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheAutoImportJob_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an auto import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/autoImportJobs/{autoImportJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the auto import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"autoImportJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("AutoImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString Clone() + { + var clone = new UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'AutoImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AutoImportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheAutoImportJob_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IAutoImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateExpanded.cs new file mode 100644 index 000000000000..400c0f1e779a --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateExpanded.cs @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheImportJob_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheImportJob_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// An import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdate(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheImportJob_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheImportJob_UpdateExpanded Clone() + { + var clone = new UpdateAzStorageCacheImportJob_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsUpdate(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheImportJob_UpdateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs new file mode 100644 index 000000000000..c864efb1aa05 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded.cs @@ -0,0 +1,589 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// An import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdate(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _amlFilesystemInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity AmlFilesystemInputObject { get => this._amlFilesystemInputObject; set => this._amlFilesystemInputObject = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded Clone() + { + var clone = new UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (AmlFilesystemInputObject?.Id != null) + { + this.AmlFilesystemInputObject.Id += $"/importJobs/{(global::System.Uri.EscapeDataString(this.Name.ToString()))}"; + await this.Client.ImportJobsUpdateViaIdentity(AmlFilesystemInputObject.Id, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == AmlFilesystemInputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + if (null == AmlFilesystemInputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("AmlFilesystemInputObject has null value for AmlFilesystemInputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, AmlFilesystemInputObject) ); + } + await this.Client.ImportJobsUpdate(AmlFilesystemInputObject.SubscriptionId ?? null, AmlFilesystemInputObject.ResourceGroupName ?? null, AmlFilesystemInputObject.AmlFilesystemName ?? null, Name, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public UpdateAzStorageCacheImportJob_UpdateViaIdentityAmlFilesystemExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..7f9f9188ed04 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded.cs @@ -0,0 +1,571 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheImportJob_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// An import job update instance. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdate _importJobBody = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.ImportJobUpdate(); + + /// + /// The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will + /// cancel the current active import job. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The administrative status of the import job. Possible values: 'Active', 'Cancel'. Passing in a value of 'Cancel' will cancel the current active import job.", + SerializedName = @"adminStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.PSArgumentCompleterAttribute("Active", "Cancel")] + public string AdminStatus { get => _importJobBody.AdminStatus ?? null; set => _importJobBody.AdminStatus = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IStorageCacheIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJobUpdateTags Tag { get => _importJobBody.Tag ?? null /* object */; set => _importJobBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._importJobBody = this._importJobBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ImportJobsUpdateViaIdentity(InputObject.Id, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AmlFilesystemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AmlFilesystemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImportJobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImportJobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ImportJobsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.AmlFilesystemName ?? null, InputObject.ImportJobName ?? null, _importJobBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheImportJob_UpdateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..973a98c45639 --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheImportJob_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + public global::System.String _jsonString; + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath Clone() + { + var clone = new UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheImportJob_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonString.cs b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonString.cs new file mode 100644 index 000000000000..4749db21e02c --- /dev/null +++ b/generated/StorageCache/StorageCache.Autorest/generated/cmdlets/UpdateAzStorageCacheImportJob_UpdateViaJsonString.cs @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Cmdlets; + using System; + + /// update an import job instance. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStorageCacheImportJob_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Description(@"update an import job instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.NotSuggestDefaultParameterSet] + public partial class UpdateAzStorageCacheImportJob_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// Backing field for property. + private string _amlFilesystemName; + + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"amlFilesystemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string AmlFilesystemName { get => this._amlFilesystemName; set => this._amlFilesystemName = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.StorageCache Client => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric.", + SerializedName = @"importJobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ImportJobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StorageCache.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStorageCacheImportJob_UpdateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Cmdlets.UpdateAzStorageCacheImportJob_UpdateViaJsonString Clone() + { + var clone = new UpdateAzStorageCacheImportJob_UpdateViaJsonString(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.AmlFilesystemName = this.AmlFilesystemName; + clone.Name = this.Name; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ImportJobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ImportJobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, AmlFilesystemName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AmlFilesystemName=AmlFilesystemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzStorageCacheImportJob_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Models.IImportJob + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs index 35ac2ce17fe0..8ec4680771bc 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -36,14 +36,23 @@ internal class PsHelpInfo public object Role { get; } public string NonTerminatingErrors { get; } + public static string CapitalizeFirstLetter(string text) + { + if (string.IsNullOrEmpty(text)) + return text; + + return char.ToUpper(text[0]) + text.Substring(1); + } + public PsHelpInfo(PSObject helpObject = null) { helpObject = helpObject ?? new PSObject(); CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); ModuleName = helpObject.GetProperty("ModuleName"); - Synopsis = helpObject.GetProperty("Synopsis"); + Synopsis = CapitalizeFirstLetter(helpObject.GetProperty("Synopsis")); Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + Description = CapitalizeFirstLetter(Description); AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); Category = helpObject.GetProperty("Category"); HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index ef32e241775a..533c076a458d 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -392,6 +392,7 @@ public CommentInfo(VariantGroup variantGroup) var helpInfo = variantGroup.HelpInfo; Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() ?? helpInfo.Description.EmptyIfNull(); + Description = PsHelpInfo.CapitalizeFirstLetter(Description); // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; Synopsis = synopsis.NullIfEmpty() ?? Description; diff --git a/generated/StorageCache/StorageCache.Autorest/generated/runtime/Context.cs b/generated/StorageCache/StorageCache.Autorest/generated/runtime/Context.cs index 1188167019d6..ea00349ccfe6 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/runtime/Context.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/runtime/Context.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime /// The IContext Interface defines the communication mechanism for input customization. /// /// - /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// In the context, we will have client, pipeline, PSBoundParameters, default EventListener, Cancellation. /// public interface IContext { diff --git a/generated/StorageCache/StorageCache.Autorest/generated/runtime/MessageAttribute.cs b/generated/StorageCache/StorageCache.Autorest/generated/runtime/MessageAttribute.cs index 7c875a45c020..fb2d4ffed174 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/runtime/MessageAttribute.cs +++ b/generated/StorageCache/StorageCache.Autorest/generated/runtime/MessageAttribute.cs @@ -16,9 +16,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.StorageCache.Runtime public class GenericBreakingChangeAttribute : Attribute { private string _message; - //A dexcription of what the change is about, non mandatory + //A description of what the change is about, non mandatory public string ChangeDescription { get; set; } = null; + //Name of the module that is being deprecated + public string moduleName { get; set; } = String.IsNullOrEmpty(@"") ? @"Az.StorageCache" : @""; + //The version the change is effective from, non mandatory public string DeprecateByVersion { get; } public string DeprecateByAzVersion { get; } @@ -82,7 +85,7 @@ public void PrintCustomAttributeInfo(Action writeOutput) } writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); - writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.moduleName, this.DeprecateByVersion)); if (OldWay != null && NewWay != null) { @@ -191,11 +194,11 @@ public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this( this.IsEstimatedGaDateSet = true; } } - + public void PrintCustomAttributeInfo(Action writeOutput) { writeOutput(this._message); - + if (IsEstimatedGaDateSet) { writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); diff --git a/generated/StorageCache/StorageCache.Autorest/generated/runtime/Properties/Resources.resx b/generated/StorageCache/StorageCache.Autorest/generated/runtime/Properties/Resources.resx index a08a2e50172b..4ef90b70573d 100644 --- a/generated/StorageCache/StorageCache.Autorest/generated/runtime/Properties/Resources.resx +++ b/generated/StorageCache/StorageCache.Autorest/generated/runtime/Properties/Resources.resx @@ -1705,7 +1705,7 @@ Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can -- The change is expected to take effect from version : '{0}' +- The change is expected to take effect in '{0}' from version : '{1}' ```powershell