From ac1f93edce95fa26af0eef07cb1d1b7cbeb54a1c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 8 May 2024 02:45:21 +0000 Subject: [PATCH] CodeGen from PR 28718 in Azure/azure-rest-api-specs Merge c4d294073a212f95088efddd9bcf32d3e451132c into dd1b1d0a58a10c4a34f55231c7035c80dd09b746 --- sdk/resourcemanager/ci.mgmt.yml | 656 +++++++------- .../Azure.ResourceManager.Storageactions.sln | 65 ++ .../CHANGELOG.md | 17 + .../Directory.Build.props | 6 + .../README.md | 80 ++ .../assets.json | 6 + ...ourceManager.Storageactions.Samples.csproj | 10 + .../Samples/Sample_StorageTaskCollection.cs | 219 +++++ .../Samples/Sample_StorageTaskResource.cs | 409 +++++++++ ...zure.ResourceManager.Storageactions.csproj | 8 + .../ArmStorageactionsModelFactory.cs | 141 +++ .../MockableStorageactionsArmClient.cs | 49 ++ ...ableStorageactionsResourceGroupResource.cs | 105 +++ ...kableStorageactionsSubscriptionResource.cs | 191 ++++ .../Extensions/StorageactionsExtensions.cs | 294 +++++++ .../src/Generated/Internal/Argument.cs | 129 +++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++++ .../Internal/ModelSerializationExtensions.cs | 398 +++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/Utf8JsonRequestContent.cs | 55 ++ .../StorageTaskOperationSource.cs | 38 + .../StorageactionsArmOperation.cs | 94 ++ .../StorageactionsArmOperationOfT.cs | 100 +++ .../Models/ElseCondition.Serialization.cs | 129 +++ .../src/Generated/Models/ElseCondition.cs | 76 ++ .../Models/IfCondition.Serialization.cs | 137 +++ .../src/Generated/Models/IfCondition.cs | 83 ++ .../src/Generated/Models/MatchedBlockName.cs | 54 ++ .../src/Generated/Models/OnFailure.cs | 48 + .../src/Generated/Models/OnSuccess.cs | 48 + .../Models/ProvisioningState.Serialization.cs | 38 + .../src/Generated/Models/ProvisioningState.cs | 28 + .../src/Generated/Models/RunResult.cs | 51 ++ .../src/Generated/Models/RunStatusEnum.cs | 51 ++ .../Models/StorageTaskAction.Serialization.cs | 134 +++ .../src/Generated/Models/StorageTaskAction.cs | 85 ++ ...TaskAssignmentsListResult.Serialization.cs | 148 ++++ .../StorageTaskAssignmentsListResult.cs | 71 ++ .../StorageTaskOperation.Serialization.cs | 175 ++++ .../Generated/Models/StorageTaskOperation.cs | 85 ++ .../Models/StorageTaskOperationName.cs | 66 ++ .../Models/StorageTaskPatch.Serialization.cs | 170 ++++ .../src/Generated/Models/StorageTaskPatch.cs | 75 ++ .../StorageTaskPreviewAction.Serialization.cs | 119 +++ .../Models/StorageTaskPreviewAction.cs | 75 ++ ...askPreviewActionCondition.Serialization.cs | 127 +++ .../StorageTaskPreviewActionCondition.cs | 93 ++ ...kPreviewActionIfCondition.Serialization.cs | 122 +++ .../StorageTaskPreviewActionIfCondition.cs | 65 ++ ...skPreviewActionProperties.Serialization.cs | 145 +++ .../StorageTaskPreviewActionProperties.cs | 90 ++ ...TaskPreviewBlobProperties.Serialization.cs | 218 +++++ .../StorageTaskPreviewBlobProperties.cs | 84 ++ ...reviewContainerProperties.Serialization.cs | 147 ++++ .../StorageTaskPreviewContainerProperties.cs | 70 ++ ...PreviewKeyValueProperties.Serialization.cs | 133 +++ .../StorageTaskPreviewKeyValueProperties.cs | 69 ++ .../StorageTaskProperties.Serialization.cs | 187 ++++ .../Generated/Models/StorageTaskProperties.cs | 100 +++ ...StorageTaskReportInstance.Serialization.cs | 181 ++++ .../Models/StorageTaskReportInstance.cs | 71 ++ ...orageTaskReportProperties.Serialization.cs | 300 +++++++ .../Models/StorageTaskReportProperties.cs | 118 +++ .../StorageTaskReportSummary.Serialization.cs | 147 ++++ .../Models/StorageTaskReportSummary.cs | 70 ++ .../StorageTasksListResult.Serialization.cs | 147 ++++ .../Models/StorageTasksListResult.cs | 70 ++ .../src/Generated/ProviderConstants.cs | 16 + .../StorageTaskAssignmentRestOperations.cs | 229 +++++ .../StorageTasksReportRestOperations.cs | 241 +++++ .../StorageTasksRestOperations.cs | 817 +++++++++++++++++ .../src/Generated/StorageTaskCollection.cs | 494 +++++++++++ .../StorageTaskData.Serialization.cs | 222 +++++ .../src/Generated/StorageTaskData.cs | 95 ++ .../StorageTaskResource.Serialization.cs | 26 + .../src/Generated/StorageTaskResource.cs | 828 ++++++++++++++++++ .../src/Properties/AssemblyInfo.cs | 9 + .../src/autorest.md | 56 ++ ...esourceManager.Storageactions.Tests.csproj | 5 + .../tests/storageactionsManagementTestBase.cs | 43 + ...storageactionsManagementTestEnvironment.cs | 11 + sdk/storageactions/ci.mgmt.yml | 24 + 83 files changed, 10930 insertions(+), 327 deletions(-) create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/Azure.ResourceManager.Storageactions.sln create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/CHANGELOG.md create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/Directory.Build.props create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/README.md create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/assets.json create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Azure.ResourceManager.Storageactions.Samples.csproj create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskCollection.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskResource.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Azure.ResourceManager.Storageactions.csproj create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ArmStorageactionsModelFactory.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsArmClient.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsResourceGroupResource.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsSubscriptionResource.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/StorageactionsExtensions.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Argument.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Optional.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageTaskOperationSource.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperation.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperationOfT.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/MatchedBlockName.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnFailure.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnSuccess.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunResult.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunStatusEnum.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperationName.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ProviderConstants.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksRestOperations.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskCollection.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/Properties/AssemblyInfo.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/src/autorest.md create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/tests/Azure.ResourceManager.Storageactions.Tests.csproj create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestBase.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestEnvironment.cs create mode 100644 sdk/storageactions/ci.mgmt.yml diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 8d752fa81ad5..2da283cebc8f 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -11,379 +11,381 @@ trigger: - sdk/resourcemanager - common/ManagementTestShared - common/ManagementCoreShared - - sdk/advisor/Azure.ResourceManager.Advisor - - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - - sdk/analysisservices/Azure.ResourceManager.Analysis - - sdk/apicenter/Azure.ResourceManager.ApiCenter - - sdk/apimanagement/Azure.ResourceManager.ApiManagement - - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation - - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration - - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights - - sdk/appplatform/Azure.ResourceManager.AppPlatform - - sdk/arc-scvmm/Azure.ResourceManager.ScVmm - - sdk/astronomer/Azure.ResourceManager.Astro - - sdk/attestation/Azure.ResourceManager.Attestation - - sdk/authorization/Azure.ResourceManager.Authorization - - sdk/automanage/Azure.ResourceManager.Automanage - - sdk/automation/Azure.ResourceManager.Automation - - sdk/avs/Azure.ResourceManager.Avs - - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - - sdk/azurestackhci/Azure.ResourceManager.Hci - - sdk/batch/Azure.ResourceManager.Batch - - sdk/billing/Azure.ResourceManager.Billing - - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - - sdk/blueprint/Azure.ResourceManager.Blueprint - - sdk/botservice/Azure.ResourceManager.BotService - - sdk/cdn/Azure.ResourceManager.Cdn - - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - - sdk/chaos/Azure.ResourceManager.Chaos - - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices - - sdk/communication/Azure.ResourceManager.Communication + - sdk/peering/Azure.ResourceManager.Peering + - sdk/support/Azure.ResourceManager.Support - sdk/compute/Azure.ResourceManager.Compute - - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger - - sdk/confluent/Azure.ResourceManager.Confluent - - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere - - sdk/consumption/Azure.ResourceManager.Consumption - - sdk/containerapps/Azure.ResourceManager.AppContainers - - sdk/containerinstance/Azure.ResourceManager.ContainerInstance - - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - - sdk/containerservice/Azure.ResourceManager.ContainerService - - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - - sdk/costmanagement/Azure.ResourceManager.CostManagement - - sdk/customer-insights/Azure.ResourceManager.CustomerInsights - - sdk/databox/Azure.ResourceManager.DataBox - - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - - sdk/datadog/Azure.ResourceManager.Datadog - - sdk/datafactory/Azure.ResourceManager.DataFactory - - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics - - sdk/datalake-store/Azure.ResourceManager.DataLakeStore - sdk/datamigration/Azure.ResourceManager.DataMigration - - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - - sdk/datashare/Azure.ResourceManager.DataShare - - sdk/defendereasm/Azure.ResourceManager.DefenderEasm - - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - - sdk/devcenter/Azure.ResourceManager.DevCenter - - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry - - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate - - sdk/devspaces/Azure.ResourceManager.DevSpaces - - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs - - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - - sdk/dns/Azure.ResourceManager.Dns - - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - - sdk/dynatrace/Azure.ResourceManager.Dynatrace - - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/edgezones/Azure.ResourceManager.EdgeZones - - sdk/elastic/Azure.ResourceManager.Elastic - - sdk/elasticsan/Azure.ResourceManager.ElasticSan - - sdk/eventgrid/Azure.ResourceManager.EventGrid - sdk/eventhub/Azure.ResourceManager.EventHubs - - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations - - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - - sdk/frontdoor/Azure.ResourceManager.FrontDoor - - sdk/grafana/Azure.ResourceManager.Grafana - - sdk/graphservices/Azure.ResourceManager.GraphServices - - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration - - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules - - sdk/hdinsight/Azure.ResourceManager.HDInsight - - sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers - - sdk/healthbot/Azure.ResourceManager.HealthBot - - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/consumption/Azure.ResourceManager.Consumption + - sdk/websites/Azure.ResourceManager.AppService + - sdk/managedservices/Azure.ResourceManager.ManagedServices + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/redis/Azure.ResourceManager.Redis + - sdk/orbital/Azure.ResourceManager.Orbital + - sdk/storage/Azure.ResourceManager.Storage + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - - sdk/iotcentral/Azure.ResourceManager.IotCentral - - sdk/iothub/Azure.ResourceManager.IotHub - - sdk/keyvault/Azure.ResourceManager.KeyVault - - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - - sdk/kusto/Azure.ResourceManager.Kusto - - sdk/labservices/Azure.ResourceManager.LabServices - - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute - - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning - - sdk/maintenance/Azure.ResourceManager.Maintenance - - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork - - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric - - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities - - sdk/managedservices/Azure.ResourceManager.ManagedServices - - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - - sdk/maps/Azure.ResourceManager.Maps - - sdk/marketplace/Azure.ResourceManager.Marketplace - - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering - - sdk/mediaservices/Azure.ResourceManager.Media + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap - - sdk/mixedreality/Azure.ResourceManager.MixedReality - - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork - - sdk/monitor/Azure.ResourceManager.Monitor - - sdk/mysql/Azure.ResourceManager.MySql - - sdk/netapp/Azure.ResourceManager.NetApp - - sdk/network/Azure.ResourceManager.Network - - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics - - sdk/networkcloud/Azure.ResourceManager.NetworkCloud - - sdk/networkfunction/Azure.ResourceManager.NetworkFunction - - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - - sdk/nginx/Azure.ResourceManager.Nginx - - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs - - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - - sdk/orbital/Azure.ResourceManager.Orbital - - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw - - sdk/peering/Azure.ResourceManager.Peering - - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting - - sdk/policyinsights/Azure.ResourceManager.PolicyInsights - - sdk/postgresql/Azure.ResourceManager.PostgreSql + - sdk/automation/Azure.ResourceManager.Automation + - sdk/batch/Azure.ResourceManager.Batch - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated - - sdk/privatedns/Azure.ResourceManager.PrivateDns - - sdk/providerhub/Azure.ResourceManager.ProviderHub - - sdk/purview/Azure.ResourceManager.Purview + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics + - sdk/iotcentral/Azure.ResourceManager.IotCentral + - sdk/storagesync/Azure.ResourceManager.StorageSync + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration + - sdk/attestation/Azure.ResourceManager.Attestation - sdk/quantum/Azure.ResourceManager.Quantum - - sdk/qumulo/Azure.ResourceManager.Qumulo + - sdk/voiceservices/Azure.ResourceManager.VoiceServices + - sdk/nginx/Azure.ResourceManager.Nginx + - sdk/automanage/Azure.ResourceManager.Automanage + - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/networkfunction/Azure.ResourceManager.NetworkFunction + - sdk/dynatrace/Azure.ResourceManager.Dynatrace + - sdk/workloads/Azure.ResourceManager.Workloads - sdk/quota/Azure.ResourceManager.Quota - - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup - - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - - sdk/redis/Azure.ResourceManager.Redis - - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance + - sdk/netapp/Azure.ResourceManager.NetApp + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter + - sdk/providerhub/Azure.ResourceManager.ProviderHub - sdk/relay/Azure.ResourceManager.Relay - - sdk/reservations/Azure.ResourceManager.Reservations - - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting + - sdk/costmanagement/Azure.ResourceManager.CostManagement + - sdk/analysisservices/Azure.ResourceManager.Analysis + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork - sdk/resourcemover/Azure.ResourceManager.ResourceMover - - sdk/resources/Azure.ResourceManager.Resources - - sdk/search/Azure.ResourceManager.Search - - sdk/securitycenter/Azure.ResourceManager.SecurityCenter - - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps - - sdk/securityinsights/Azure.ResourceManager.SecurityInsights - - sdk/selfhelp/Azure.ResourceManager.SelfHelp - - sdk/servicebus/Azure.ResourceManager.ServiceBus - - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/edgezones/Azure.ResourceManager.EdgeZones + - sdk/monitor/Azure.ResourceManager.Monitor + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger + - sdk/datashare/Azure.ResourceManager.DataShare + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters - - sdk/servicelinker/Azure.ResourceManager.ServiceLinker - - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking - - sdk/signalr/Azure.ResourceManager.SignalR - - sdk/sphere/Azure.ResourceManager.Sphere - - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery - - sdk/sqlmanagement/Azure.ResourceManager.Sql - - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine + - sdk/search/Azure.ResourceManager.Search + - sdk/marketplace/Azure.ResourceManager.Marketplace + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric + - sdk/purview/Azure.ResourceManager.Purview + - sdk/astronomer/Azure.ResourceManager.Astro - sdk/standbypool/Azure.ResourceManager.StandbyPool - - sdk/storage/Azure.ResourceManager.Storage - - sdk/storagecache/Azure.ResourceManager.StorageCache - - sdk/storagemover/Azure.ResourceManager.StorageMover - - sdk/storagepool/Azure.ResourceManager.StoragePool - - sdk/storagesync/Azure.ResourceManager.StorageSync - - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics - sdk/subscription/Azure.ResourceManager.Subscription - - sdk/support/Azure.ResourceManager.Support - - sdk/synapse/Azure.ResourceManager.Synapse - - sdk/trafficmanager/Azure.ResourceManager.TrafficManager - - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning - - sdk/voiceservices/Azure.ResourceManager.VoiceServices - - sdk/webpubsub/Azure.ResourceManager.WebPubSub - - sdk/websites/Azure.ResourceManager.AppService - - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - - sdk/workloads/Azure.ResourceManager.Workloads - -pr: - branches: - include: - - main - - feature/* - - hotfix/* - - release/* - paths: - include: - - sdk/resourcemanager - - common/ManagementTestShared - - common/ManagementCoreShared - - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins + - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability + - sdk/cdn/Azure.ResourceManager.Cdn + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise + - sdk/chaos/Azure.ResourceManager.Chaos + - sdk/servicebus/Azure.ResourceManager.ServiceBus + - sdk/elastic/Azure.ResourceManager.Elastic + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense + - sdk/sqlmanagement/Azure.ResourceManager.Sql - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - - sdk/analysisservices/Azure.ResourceManager.Analysis - - sdk/apicenter/Azure.ResourceManager.ApiCenter - - sdk/apimanagement/Azure.ResourceManager.ApiManagement - - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation - - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration - - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights - - sdk/appplatform/Azure.ResourceManager.AppPlatform - - sdk/arc-scvmm/Azure.ResourceManager.ScVmm - - sdk/astronomer/Azure.ResourceManager.Astro - - sdk/attestation/Azure.ResourceManager.Attestation - - sdk/authorization/Azure.ResourceManager.Authorization - - sdk/automanage/Azure.ResourceManager.Automanage - - sdk/automation/Azure.ResourceManager.Automation - - sdk/avs/Azure.ResourceManager.Avs + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery + - sdk/datadog/Azure.ResourceManager.Datadog + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/devcenter/Azure.ResourceManager.DevCenter + - sdk/keyvault/Azure.ResourceManager.KeyVault + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - - sdk/azurestackhci/Azure.ResourceManager.Hci - - sdk/batch/Azure.ResourceManager.Batch - - sdk/billing/Azure.ResourceManager.Billing - - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - - sdk/blueprint/Azure.ResourceManager.Blueprint - - sdk/botservice/Azure.ResourceManager.BotService - - sdk/cdn/Azure.ResourceManager.Cdn - - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - - sdk/chaos/Azure.ResourceManager.Chaos - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices - - sdk/communication/Azure.ResourceManager.Communication - - sdk/compute/Azure.ResourceManager.Compute - - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger - - sdk/confluent/Azure.ResourceManager.Confluent + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices + - sdk/containerservice/Azure.ResourceManager.ContainerService + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere - - sdk/consumption/Azure.ResourceManager.Consumption + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/apimanagement/Azure.ResourceManager.ApiManagement + - sdk/frontdoor/Azure.ResourceManager.FrontDoor + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/graphservices/Azure.ResourceManager.GraphServices + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - sdk/containerapps/Azure.ResourceManager.AppContainers - - sdk/containerinstance/Azure.ResourceManager.ContainerInstance - - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - - sdk/containerservice/Azure.ResourceManager.ContainerService - - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - - sdk/costmanagement/Azure.ResourceManager.CostManagement - - sdk/customer-insights/Azure.ResourceManager.CustomerInsights - - sdk/databox/Azure.ResourceManager.DataBox - - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - - sdk/datadog/Azure.ResourceManager.Datadog - - sdk/datafactory/Azure.ResourceManager.DataFactory - - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights + - sdk/confluent/Azure.ResourceManager.Confluent - sdk/datalake-store/Azure.ResourceManager.DataLakeStore - - sdk/datamigration/Azure.ResourceManager.DataMigration - - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - - sdk/datashare/Azure.ResourceManager.DataShare - - sdk/defendereasm/Azure.ResourceManager.DefenderEasm - - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - - sdk/devcenter/Azure.ResourceManager.DevCenter - - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/healthbot/Azure.ResourceManager.HealthBot + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay + - sdk/iothub/Azure.ResourceManager.IotHub - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate - - sdk/devspaces/Azure.ResourceManager.DevSpaces - - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs - - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - - sdk/dns/Azure.ResourceManager.Dns - - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - - sdk/dynatrace/Azure.ResourceManager.Dynatrace - - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/edgezones/Azure.ResourceManager.EdgeZones - - sdk/elastic/Azure.ResourceManager.Elastic - - sdk/elasticsan/Azure.ResourceManager.ElasticSan + - sdk/communication/Azure.ResourceManager.Communication + - sdk/billing/Azure.ResourceManager.Billing + - sdk/maps/Azure.ResourceManager.Maps + - sdk/botservice/Azure.ResourceManager.BotService + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup + - sdk/storagecache/Azure.ResourceManager.StorageCache + - sdk/selfhelp/Azure.ResourceManager.SelfHelp + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication + - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/signalr/Azure.ResourceManager.SignalR + - sdk/avs/Azure.ResourceManager.Avs + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights + - sdk/kusto/Azure.ResourceManager.Kusto + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery + - sdk/apicenter/Azure.ResourceManager.ApiCenter + - sdk/network/Azure.ResourceManager.Network + - sdk/resources/Azure.ResourceManager.Resources + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker + - sdk/storageactions/Azure.ResourceManager.Storageactions + - sdk/mediaservices/Azure.ResourceManager.Media + - sdk/storagepool/Azure.ResourceManager.StoragePool - sdk/eventgrid/Azure.ResourceManager.EventGrid - - sdk/eventhub/Azure.ResourceManager.EventHubs - - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/datafactory/Azure.ResourceManager.DataFactory + - sdk/privatedns/Azure.ResourceManager.PrivateDns - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - - sdk/frontdoor/Azure.ResourceManager.FrontDoor - - sdk/grafana/Azure.ResourceManager.Grafana - - sdk/graphservices/Azure.ResourceManager.GraphServices - - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration - - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules + - sdk/appplatform/Azure.ResourceManager.AppPlatform - sdk/hdinsight/Azure.ResourceManager.HDInsight - sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers - - sdk/healthbot/Azure.ResourceManager.HealthBot + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/blueprint/Azure.ResourceManager.Blueprint + - sdk/sphere/Azure.ResourceManager.Sphere + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm + - sdk/mysql/Azure.ResourceManager.MySql + - sdk/grafana/Azure.ResourceManager.Grafana + - sdk/dns/Azure.ResourceManager.Dns + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute + - sdk/postgresql/Azure.ResourceManager.PostgreSql + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry + - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/qumulo/Azure.ResourceManager.Qumulo + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration + - sdk/azurestackhci/Azure.ResourceManager.Hci + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor + - sdk/authorization/Azure.ResourceManager.Authorization + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql + - sdk/mixedreality/Azure.ResourceManager.MixedReality + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/databox/Azure.ResourceManager.DataBox + - sdk/synapse/Azure.ResourceManager.Synapse + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge + - sdk/maintenance/Azure.ResourceManager.Maintenance + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics + - sdk/elasticsan/Azure.ResourceManager.ElasticSan - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/webpubsub/Azure.ResourceManager.WebPubSub + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager + - common/ManagementTestShared + - common/ManagementCoreShared + - sdk/peering/Azure.ResourceManager.Peering + - sdk/support/Azure.ResourceManager.Support + - sdk/compute/Azure.ResourceManager.Compute + - sdk/datamigration/Azure.ResourceManager.DataMigration + - sdk/eventhub/Azure.ResourceManager.EventHubs + - sdk/consumption/Azure.ResourceManager.Consumption + - sdk/websites/Azure.ResourceManager.AppService + - sdk/managedservices/Azure.ResourceManager.ManagedServices + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/redis/Azure.ResourceManager.Redis + - sdk/orbital/Azure.ResourceManager.Orbital + - sdk/storage/Azure.ResourceManager.Storage + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - - sdk/iotcentral/Azure.ResourceManager.IotCentral - - sdk/iothub/Azure.ResourceManager.IotHub - - sdk/keyvault/Azure.ResourceManager.KeyVault - - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - - sdk/kusto/Azure.ResourceManager.Kusto - - sdk/labservices/Azure.ResourceManager.LabServices - - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute - - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning - - sdk/maintenance/Azure.ResourceManager.Maintenance - - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork - - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric - - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities - - sdk/managedservices/Azure.ResourceManager.ManagedServices - - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - - sdk/maps/Azure.ResourceManager.Maps - - sdk/marketplace/Azure.ResourceManager.Marketplace - - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering - - sdk/mediaservices/Azure.ResourceManager.Media + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap - - sdk/mixedreality/Azure.ResourceManager.MixedReality - - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork - - sdk/monitor/Azure.ResourceManager.Monitor - - sdk/mysql/Azure.ResourceManager.MySql - - sdk/netapp/Azure.ResourceManager.NetApp - - sdk/network/Azure.ResourceManager.Network + - sdk/automation/Azure.ResourceManager.Automation + - sdk/batch/Azure.ResourceManager.Batch + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics - - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/iotcentral/Azure.ResourceManager.IotCentral + - sdk/storagesync/Azure.ResourceManager.StorageSync + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration + - sdk/attestation/Azure.ResourceManager.Attestation + - sdk/quantum/Azure.ResourceManager.Quantum + - sdk/voiceservices/Azure.ResourceManager.VoiceServices + - sdk/nginx/Azure.ResourceManager.Nginx + - sdk/automanage/Azure.ResourceManager.Automanage + - sdk/storagemover/Azure.ResourceManager.StorageMover - sdk/networkfunction/Azure.ResourceManager.NetworkFunction + - sdk/dynatrace/Azure.ResourceManager.Dynatrace + - sdk/workloads/Azure.ResourceManager.Workloads + - sdk/quota/Azure.ResourceManager.Quota + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance + - sdk/netapp/Azure.ResourceManager.NetApp + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter + - sdk/providerhub/Azure.ResourceManager.ProviderHub + - sdk/relay/Azure.ResourceManager.Relay + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting + - sdk/costmanagement/Azure.ResourceManager.CostManagement + - sdk/analysisservices/Azure.ResourceManager.Analysis + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork + - sdk/resourcemover/Azure.ResourceManager.ResourceMover + - sdk/edgezones/Azure.ResourceManager.EdgeZones + - sdk/monitor/Azure.ResourceManager.Monitor + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger + - sdk/datashare/Azure.ResourceManager.DataShare + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph + - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters + - sdk/search/Azure.ResourceManager.Search + - sdk/marketplace/Azure.ResourceManager.Marketplace + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric + - sdk/purview/Azure.ResourceManager.Purview + - sdk/astronomer/Azure.ResourceManager.Astro + - sdk/standbypool/Azure.ResourceManager.StandbyPool + - sdk/subscription/Azure.ResourceManager.Subscription + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - - sdk/nginx/Azure.ResourceManager.Nginx + - sdk/cdn/Azure.ResourceManager.Cdn - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise + - sdk/chaos/Azure.ResourceManager.Chaos + - sdk/servicebus/Azure.ResourceManager.ServiceBus + - sdk/elastic/Azure.ResourceManager.Elastic + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense + - sdk/sqlmanagement/Azure.ResourceManager.Sql + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery + - sdk/datadog/Azure.ResourceManager.Datadog + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/devcenter/Azure.ResourceManager.DevCenter + - sdk/keyvault/Azure.ResourceManager.KeyVault + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices + - sdk/containerservice/Azure.ResourceManager.ContainerService - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - - sdk/orbital/Azure.ResourceManager.Orbital - - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw - - sdk/peering/Azure.ResourceManager.Peering + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/apimanagement/Azure.ResourceManager.ApiManagement + - sdk/frontdoor/Azure.ResourceManager.FrontDoor + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting - - sdk/policyinsights/Azure.ResourceManager.PolicyInsights - - sdk/postgresql/Azure.ResourceManager.PostgreSql - - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated - - sdk/privatedns/Azure.ResourceManager.PrivateDns - - sdk/providerhub/Azure.ResourceManager.ProviderHub - - sdk/purview/Azure.ResourceManager.Purview - - sdk/quantum/Azure.ResourceManager.Quantum - - sdk/qumulo/Azure.ResourceManager.Qumulo - - sdk/quota/Azure.ResourceManager.Quota - - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup - - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - - sdk/redis/Azure.ResourceManager.Redis - - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise - - sdk/relay/Azure.ResourceManager.Relay - - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/graphservices/Azure.ResourceManager.GraphServices + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth - - sdk/resourcemover/Azure.ResourceManager.ResourceMover - - sdk/resources/Azure.ResourceManager.Resources - - sdk/search/Azure.ResourceManager.Search - - sdk/securitycenter/Azure.ResourceManager.SecurityCenter + - sdk/containerapps/Azure.ResourceManager.AppContainers + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights + - sdk/confluent/Azure.ResourceManager.Confluent + - sdk/datalake-store/Azure.ResourceManager.DataLakeStore - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps - sdk/securityinsights/Azure.ResourceManager.SecurityInsights + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/healthbot/Azure.ResourceManager.HealthBot + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay + - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate + - sdk/communication/Azure.ResourceManager.Communication + - sdk/billing/Azure.ResourceManager.Billing + - sdk/maps/Azure.ResourceManager.Maps + - sdk/botservice/Azure.ResourceManager.BotService + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup + - sdk/storagecache/Azure.ResourceManager.StorageCache - sdk/selfhelp/Azure.ResourceManager.SelfHelp - - sdk/servicebus/Azure.ResourceManager.ServiceBus - - sdk/servicefabric/Azure.ResourceManager.ServiceFabric - - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters - - sdk/servicelinker/Azure.ResourceManager.ServiceLinker - - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication + - sdk/advisor/Azure.ResourceManager.Advisor - sdk/signalr/Azure.ResourceManager.SignalR - - sdk/sphere/Azure.ResourceManager.Sphere + - sdk/avs/Azure.ResourceManager.Avs + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights + - sdk/kusto/Azure.ResourceManager.Kusto + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery - - sdk/sqlmanagement/Azure.ResourceManager.Sql - - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine - - sdk/standbypool/Azure.ResourceManager.StandbyPool - - sdk/storage/Azure.ResourceManager.Storage - - sdk/storagecache/Azure.ResourceManager.StorageCache - - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/apicenter/Azure.ResourceManager.ApiCenter + - sdk/network/Azure.ResourceManager.Network + - sdk/resources/Azure.ResourceManager.Resources + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker + - sdk/storageactions/Azure.ResourceManager.Storageactions + - sdk/mediaservices/Azure.ResourceManager.Media - sdk/storagepool/Azure.ResourceManager.StoragePool - - sdk/storagesync/Azure.ResourceManager.StorageSync - - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics - - sdk/subscription/Azure.ResourceManager.Subscription - - sdk/support/Azure.ResourceManager.Support + - sdk/eventgrid/Azure.ResourceManager.EventGrid + - sdk/datafactory/Azure.ResourceManager.DataFactory + - sdk/privatedns/Azure.ResourceManager.PrivateDns + - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet + - sdk/appplatform/Azure.ResourceManager.AppPlatform + - sdk/hdinsight/Azure.ResourceManager.HDInsight + - sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/blueprint/Azure.ResourceManager.Blueprint + - sdk/sphere/Azure.ResourceManager.Sphere + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm + - sdk/mysql/Azure.ResourceManager.MySql + - sdk/grafana/Azure.ResourceManager.Grafana + - sdk/dns/Azure.ResourceManager.Dns + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute + - sdk/postgresql/Azure.ResourceManager.PostgreSql + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry + - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/qumulo/Azure.ResourceManager.Qumulo + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration + - sdk/azurestackhci/Azure.ResourceManager.Hci + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor + - sdk/authorization/Azure.ResourceManager.Authorization + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql + - sdk/mixedreality/Azure.ResourceManager.MixedReality + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/databox/Azure.ResourceManager.DataBox - sdk/synapse/Azure.ResourceManager.Synapse - - sdk/trafficmanager/Azure.ResourceManager.TrafficManager - - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning - - sdk/voiceservices/Azure.ResourceManager.VoiceServices + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge + - sdk/maintenance/Azure.ResourceManager.Maintenance + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics + - sdk/elasticsan/Azure.ResourceManager.ElasticSan + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - sdk/webpubsub/Azure.ResourceManager.WebPubSub - - sdk/websites/Azure.ResourceManager.AppService - - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - - sdk/workloads/Azure.ResourceManager.Workloads extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/Azure.ResourceManager.Storageactions.sln b/sdk/storageactions/Azure.ResourceManager.Storageactions/Azure.ResourceManager.Storageactions.sln new file mode 100644 index 000000000000..ac542fae105c --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/Azure.ResourceManager.Storageactions.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{547EA323-AD18-475C-9EDD-3845E5679A2E}") = "Azure.ResourceManager.Storageactions", "src\Azure.ResourceManager.Storageactions.csproj", "{D6113F39-95C7-4B01-8073-A8468F4692CA}" +EndProject +Project("{547EA323-AD18-475C-9EDD-3845E5679A2E}") = "Azure.ResourceManager.Storageactions.Tests", "tests\Azure.ResourceManager.Storageactions.Tests.csproj", "{156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}" +EndProject +Project("{547EA323-AD18-475C-9EDD-3845E5679A2E}") = "Azure.ResourceManager.Storageactions.Samples", "samples\Azure.ResourceManager.Storageactions.Samples.csproj", "{C6E57363-83D4-44EE-8DFF-853C684EB91F}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5D3C7DCA-50B2-4E88-9078-5B82E0E62EED} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|x64.ActiveCfg = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|x64.Build.0 = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|x86.ActiveCfg = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Debug|x86.Build.0 = Debug|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|Any CPU.Build.0 = Release|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|x64.ActiveCfg = Release|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|x64.Build.0 = Release|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|x86.ActiveCfg = Release|Any CPU + {D6113F39-95C7-4B01-8073-A8468F4692CA}.Release|x86.Build.0 = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|x64.ActiveCfg = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|x64.Build.0 = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|x86.ActiveCfg = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Debug|x86.Build.0 = Debug|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|Any CPU.Build.0 = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|x64.ActiveCfg = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|x64.Build.0 = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|x86.ActiveCfg = Release|Any CPU + {156C8C8D-ADBB-4646-91F9-15DA16F1AE5A}.Release|x86.Build.0 = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|x64.ActiveCfg = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|x64.Build.0 = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|x86.ActiveCfg = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Debug|x86.Build.0 = Debug|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|Any CPU.Build.0 = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|x64.ActiveCfg = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|x64.Build.0 = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|x86.ActiveCfg = Release|Any CPU + {C6E57363-83D4-44EE-8DFF-853C684EB91F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/CHANGELOG.md b/sdk/storageactions/Azure.ResourceManager.Storageactions/CHANGELOG.md new file mode 100644 index 000000000000..23f86d1e896e --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### General New Features + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/Directory.Build.props b/sdk/storageactions/Azure.ResourceManager.Storageactions/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/README.md b/sdk/storageactions/Azure.ResourceManager.Storageactions/README.md new file mode 100644 index 000000000000..028b6c00dc12 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure storageactions management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure storageactions management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Storageactions --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/assets.json b/sdk/storageactions/Azure.ResourceManager.Storageactions/assets.json new file mode 100644 index 000000000000..c081239e19e8 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net//Azure.ResourceManager.Storageactions", + "Tag": "" +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Azure.ResourceManager.Storageactions.Samples.csproj b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Azure.ResourceManager.Storageactions.Samples.csproj new file mode 100644 index 000000000000..42cbcef92121 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Azure.ResourceManager.Storageactions.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskCollection.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskCollection.cs new file mode 100644 index 000000000000..5ac2cc2a354c --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions.Samples +{ + public partial class Sample_StorageTaskCollection + { + // PutStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json + // this example is just showing the usage of "StorageTasks_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageTaskResource + StorageTaskCollection collection = resourceGroupResource.GetStorageTasks(); + + // invoke the operation + string storageTaskName = "mytask1"; + StorageTaskData data = new StorageTaskData(new AzureLocation("westus"), new ManagedServiceIdentity("SystemAssigned"), new StorageTaskProperties(true, "My Storage task", new StorageTaskAction(new IfCondition("[[equals(AccessTier, 'Cool')]]", new StorageTaskOperation[] + { +new StorageTaskOperation(StorageTaskOperationName.SetBlobTier) +{ +Parameters = +{ +["tier"] = "Hot", +}, +OnSuccess = OnSuccess.Continue, +OnFailure = OnFailure.Break, +} + })) + { + ElseOperations = +{ +new StorageTaskOperation(StorageTaskOperationName.DeleteBlob) +{ +OnSuccess = OnSuccess.Continue, +OnFailure = OnFailure.Break, +} +}, + })); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, storageTaskName, data); + StorageTaskResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json + // this example is just showing the usage of "StorageTasks_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageTaskResource + StorageTaskCollection collection = resourceGroupResource.GetStorageTasks(); + + // invoke the operation + string storageTaskName = "mytask1"; + StorageTaskResource result = await collection.GetAsync(storageTaskName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json + // this example is just showing the usage of "StorageTasks_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageTaskResource + StorageTaskCollection collection = resourceGroupResource.GetStorageTasks(); + + // invoke the operation + string storageTaskName = "mytask1"; + bool result = await collection.ExistsAsync(storageTaskName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json + // this example is just showing the usage of "StorageTasks_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageTaskResource + StorageTaskCollection collection = resourceGroupResource.GetStorageTasks(); + + // invoke the operation + string storageTaskName = "mytask1"; + NullableResponse response = await collection.GetIfExistsAsync(storageTaskName); + StorageTaskResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ListStorageTasksByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListStorageTasksByResourceGroup() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json + // this example is just showing the usage of "StorageTasks_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res6117"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageTaskResource + StorageTaskCollection collection = resourceGroupResource.GetStorageTasks(); + + // invoke the operation and iterate over the result + await foreach (StorageTaskResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskResource.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskResource.cs new file mode 100644 index 000000000000..7e377f0e0309 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/samples/Generated/Samples/Sample_StorageTaskResource.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions.Samples +{ + public partial class Sample_StorageTaskResource + { + // DeleteStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json + // this example is just showing the usage of "StorageTasks_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StorageTaskResource created on azure + // for more information of creating StorageTaskResource, please refer to the document of StorageTaskResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + string storageTaskName = "mytask1"; + ResourceIdentifier storageTaskResourceId = StorageTaskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageTaskName); + StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); + + // invoke the operation + await storageTask.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GetStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json + // this example is just showing the usage of "StorageTasks_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StorageTaskResource created on azure + // for more information of creating StorageTaskResource, please refer to the document of StorageTaskResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + string storageTaskName = "mytask1"; + ResourceIdentifier storageTaskResourceId = StorageTaskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageTaskName); + StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); + + // invoke the operation + StorageTaskResource result = await storageTask.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchStorageTask + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchStorageTask() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json + // this example is just showing the usage of "StorageTasks_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StorageTaskResource created on azure + // for more information of creating StorageTaskResource, please refer to the document of StorageTaskResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "res4228"; + string storageTaskName = "mytask1"; + ResourceIdentifier storageTaskResourceId = StorageTaskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageTaskName); + StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); + + // invoke the operation + StorageTaskPatch patch = new StorageTaskPatch() + { + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/1f31ba14-ce16-4281-b9b4-3e78da6e1616/resourceGroups/res4228/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserAssignedIdentity")] = new UserAssignedIdentity(), +}, + }, + Properties = new StorageTaskProperties(true, "My Storage task", new StorageTaskAction(new IfCondition("[[equals(AccessTier, 'Cool')]]", new StorageTaskOperation[] + { +new StorageTaskOperation(StorageTaskOperationName.SetBlobTier) +{ +Parameters = +{ +["tier"] = "Hot", +}, +OnSuccess = OnSuccess.Continue, +OnFailure = OnFailure.Break, +} + })) + { + ElseOperations = +{ +new StorageTaskOperation(StorageTaskOperationName.DeleteBlob) +{ +OnSuccess = OnSuccess.Continue, +OnFailure = OnFailure.Break, +} +}, + }), + }; + ArmOperation lro = await storageTask.UpdateAsync(WaitUntil.Completed, patch); + StorageTaskResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ListStorageTasksBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetStorageTasks_ListStorageTasksBySubscription() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json + // this example is just showing the usage of "StorageTasks_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (StorageTaskResource item in subscriptionResource.GetStorageTasksAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StorageTaskData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // PerformStorageTaskActionsPreview + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task PreviewActionsStorageTask_PerformStorageTaskActionsPreview() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json + // this example is just showing the usage of "StorageTasks_PreviewActions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + StorageTaskPreviewAction storageTaskPreviewAction = new StorageTaskPreviewAction(new StorageTaskPreviewActionProperties(new StorageTaskPreviewContainerProperties() + { + Name = "firstContainer", + Metadata = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "mContainerKey1", +Value = "mContainerValue1", +} +}, + }, new StorageTaskPreviewBlobProperties[] + { +new StorageTaskPreviewBlobProperties() +{ +Name = "folder1/file1.txt", +Properties = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "Creation-Time", +Value = "Wed, 07 Jun 2023 05:23:29 GMT", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Last-Modified", +Value = "Wed, 07 Jun 2023 05:23:29 GMT", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Etag", +Value = "0x8DB67175454D36D", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-Length", +Value = "38619", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-Type", +Value = "text/xml", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-Encoding", +Value = "", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-Language", +Value = "", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-CRC64", +Value = "", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-MD5", +Value = "njr6iDrmU9+FC89WMK22EA==", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Cache-Control", +Value = "", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Content-Disposition", +Value = "", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "BlobType", +Value = "BlockBlob", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "AccessTier", +Value = "Hot", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "AccessTierInferred", +Value = "true", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "LeaseStatus", +Value = "unlocked", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "LeaseState", +Value = "available", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "ServerEncrypted", +Value = "true", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "TagCount", +Value = "1", +} +}, +Metadata = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "mKey1", +Value = "mValue1", +} +}, +Tags = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "tKey1", +Value = "tValue1", +} +}, +},new StorageTaskPreviewBlobProperties() +{ +Name = "folder2/file1.txt", +Properties = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "Creation-Time", +Value = "Wed, 06 Jun 2023 05:23:29 GMT", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Last-Modified", +Value = "Wed, 06 Jun 2023 05:23:29 GMT", +},new StorageTaskPreviewKeyValueProperties() +{ +Key = "Etag", +Value = "0x6FB67175454D36D", +} +}, +Metadata = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "mKey2", +Value = "mValue2", +} +}, +Tags = +{ +new StorageTaskPreviewKeyValueProperties() +{ +Key = "tKey2", +Value = "tValue2", +} +}, +} + }, new StorageTaskPreviewActionCondition(new StorageTaskPreviewActionIfCondition() + { + Condition = "[[equals(AccessTier, 'Hot')]]", + }, true))); + StorageTaskPreviewAction result = await subscriptionResource.PreviewActionsStorageTaskAsync(location, storageTaskPreviewAction); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ListStorageTaskAssignmentsByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetStorageTaskAssignments_ListStorageTaskAssignmentsByResourceGroup() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json + // this example is just showing the usage of "StorageTaskAssignment_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StorageTaskResource created on azure + // for more information of creating StorageTaskResource, please refer to the document of StorageTaskResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "rgroup1"; + string storageTaskName = "mytask1"; + ResourceIdentifier storageTaskResourceId = StorageTaskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageTaskName); + StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); + + // invoke the operation and iterate over the result + await foreach (SubResource item in storageTask.GetStorageTaskAssignmentsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ListStorageTasksByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetStorageTasksReports_ListStorageTasksByResourceGroup() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json + // this example is just showing the usage of "StorageTasksReport_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StorageTaskResource created on azure + // for more information of creating StorageTaskResource, please refer to the document of StorageTaskResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + string resourceGroupName = "rgroup1"; + string storageTaskName = "mytask1"; + ResourceIdentifier storageTaskResourceId = StorageTaskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageTaskName); + StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); + + // invoke the operation and iterate over the result + await foreach (StorageTaskReportInstance item in storageTask.GetStorageTasksReportsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Azure.ResourceManager.Storageactions.csproj b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Azure.ResourceManager.Storageactions.csproj new file mode 100644 index 000000000000..36c1e68220e6 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Azure.ResourceManager.Storageactions.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.Storageactions + Azure Resource Manager client SDK for Azure resource provider storageactions. + azure;management;arm;resource manager;storageactions + + diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ArmStorageactionsModelFactory.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ArmStorageactionsModelFactory.cs new file mode 100644 index 000000000000..fce966d9a3c1 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ArmStorageactionsModelFactory.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Model factory for models. + public static partial class ArmStorageactionsModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The managed service identity of the resource. + /// Properties of the storage task. + /// A new instance for mocking. + public static StorageTaskData StorageTaskData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, StorageTaskProperties properties = null) + { + tags ??= new Dictionary(); + + return new StorageTaskData( + id, + name, + resourceType, + systemData, + tags, + location, + identity, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Storage task version. + /// Storage Task is enabled when set to true and disabled when set to false. + /// Text that describes the purpose of the storage task. + /// The storage task action that is executed. + /// Represents the provisioning state of the storage task. + /// The creation date and time of the storage task in UTC. + /// A new instance for mocking. + public static StorageTaskProperties StorageTaskProperties(long? taskVersion = null, bool enabled = default, string description = null, StorageTaskAction action = null, ProvisioningState? provisioningState = null, DateTimeOffset? creationTimeInUtc = null) + { + return new StorageTaskProperties( + taskVersion, + enabled, + description, + action, + provisioningState, + creationTimeInUtc, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Storage task execution report for a run instance. + /// A new instance for mocking. + public static StorageTaskReportInstance StorageTaskReportInstance(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, StorageTaskReportProperties properties = null) + { + return new StorageTaskReportInstance( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource ID of the Storage Task Assignment associated with this reported run. + /// Resource ID of the Storage Account where this reported run executed. + /// Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects that meet the condition as defined in the storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects where task operation succeeded when was attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Well known Azure Storage error code that represents the error encountered during execution of the run instance. + /// Represents the status of the execution. + /// Full path to the verbose report stored in the reporting container as specified in the assignment execution context for the storage account. + /// Resource ID of the Storage Task applied during this run. + /// Storage Task Version. + /// Represents the overall result of the execution for the run instance. + /// A new instance for mocking. + public static StorageTaskReportProperties StorageTaskReportProperties(ResourceIdentifier taskAssignmentId = null, ResourceIdentifier storageAccountId = null, string startTime = null, string finishTime = null, string objectsTargetedCount = null, string objectsOperatedOnCount = null, string objectFailedCount = null, string objectsSucceededCount = null, string runStatusError = null, RunStatusEnum? runStatusEnum = null, string summaryReportPath = null, ResourceIdentifier taskId = null, string taskVersion = null, RunResult? runResult = null) + { + return new StorageTaskReportProperties( + taskAssignmentId, + storageAccountId, + startTime, + finishTime, + objectsTargetedCount, + objectsOperatedOnCount, + objectFailedCount, + objectsSucceededCount, + runStatusError, + runStatusEnum, + summaryReportPath, + taskId, + taskVersion, + runResult, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of test blob. + /// properties key value pairs to be tested for a match against the provided condition. + /// metadata key value pairs to be tested for a match against the provided condition. + /// tags key value pairs to be tested for a match against the provided condition. + /// Represents the condition block name that matched blob properties. + /// A new instance for mocking. + public static StorageTaskPreviewBlobProperties StorageTaskPreviewBlobProperties(string name = null, IEnumerable properties = null, IEnumerable metadata = null, IEnumerable tags = null, MatchedBlockName? matchedBlock = null) + { + properties ??= new List(); + metadata ??= new List(); + tags ??= new List(); + + return new StorageTaskPreviewBlobProperties( + name, + properties?.ToList(), + metadata?.ToList(), + tags?.ToList(), + matchedBlock, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsArmClient.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsArmClient.cs new file mode 100644 index 000000000000..6150b67bb764 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStorageactionsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageactionsArmClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableStorageactionsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStorageactionsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageTaskResource GetStorageTaskResource(ResourceIdentifier id) + { + StorageTaskResource.ValidateResourceId(id); + return new StorageTaskResource(Client, id); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsResourceGroupResource.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsResourceGroupResource.cs new file mode 100644 index 000000000000..33aa4363d409 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStorageactionsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageactionsResourceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableStorageactionsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of StorageTaskResources in the ResourceGroupResource. + /// An object representing collection of StorageTaskResources and their operations over a StorageTaskResource. + public virtual StorageTaskCollection GetStorageTasks() + { + return GetCachedClient(client => new StorageTaskCollection(client, Id)); + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageTaskAsync(string storageTaskName, CancellationToken cancellationToken = default) + { + return await GetStorageTasks().GetAsync(storageTaskName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageTask(string storageTaskName, CancellationToken cancellationToken = default) + { + return GetStorageTasks().Get(storageTaskName, cancellationToken); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsSubscriptionResource.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsSubscriptionResource.cs new file mode 100644 index 000000000000..2f781d4a52e4 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/MockableStorageactionsSubscriptionResource.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStorageactionsSubscriptionResource : ArmResource + { + private ClientDiagnostics _storageTaskClientDiagnostics; + private StorageTasksRestOperations _storageTaskRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStorageactionsSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableStorageactionsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics StorageTaskClientDiagnostics => _storageTaskClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storageactions", StorageTaskResource.ResourceType.Namespace, Diagnostics); + private StorageTasksRestOperations StorageTaskRestClient => _storageTaskRestClient ??= new StorageTasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageTaskResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the storage tasks available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListBySubscription + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTasksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageactionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the storage tasks available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListBySubscription + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTasks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageactionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); + } + + /// + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// + /// + /// Operation Id + /// StorageTasks_PreviewActions + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// is null. + public virtual async Task> PreviewActionsStorageTaskAsync(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageactionsSubscriptionResource.PreviewActionsStorageTask"); + scope.Start(); + try + { + var response = await StorageTaskRestClient.PreviewActionsAsync(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// + /// + /// Operation Id + /// StorageTasks_PreviewActions + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// is null. + public virtual Response PreviewActionsStorageTask(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageactionsSubscriptionResource.PreviewActionsStorageTask"); + scope.Start(); + try + { + var response = StorageTaskRestClient.PreviewActions(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/StorageactionsExtensions.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/StorageactionsExtensions.cs new file mode 100644 index 000000000000..bf9fdd37786a --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Extensions/StorageactionsExtensions.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Storageactions.Mocking; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + /// A class to add extension methods to Azure.ResourceManager.Storageactions. + public static partial class StorageactionsExtensions + { + private static MockableStorageactionsArmClient GetMockableStorageactionsArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableStorageactionsArmClient(client0)); + } + + private static MockableStorageactionsResourceGroupResource GetMockableStorageactionsResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableStorageactionsResourceGroupResource(client, resource.Id)); + } + + private static MockableStorageactionsSubscriptionResource GetMockableStorageactionsSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableStorageactionsSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StorageTaskResource GetStorageTaskResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableStorageactionsArmClient(client).GetStorageTaskResource(id); + } + + /// + /// Gets a collection of StorageTaskResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of StorageTaskResources and their operations over a StorageTaskResource. + public static StorageTaskCollection GetStorageTasks(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableStorageactionsResourceGroupResource(resourceGroupResource).GetStorageTasks(); + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetStorageTaskAsync(this ResourceGroupResource resourceGroupResource, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableStorageactionsResourceGroupResource(resourceGroupResource).GetStorageTaskAsync(storageTaskName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetStorageTask(this ResourceGroupResource resourceGroupResource, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableStorageactionsResourceGroupResource(resourceGroupResource).GetStorageTask(storageTaskName, cancellationToken); + } + + /// + /// Lists all the storage tasks available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListBySubscription + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetStorageTasksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableStorageactionsSubscriptionResource(subscriptionResource).GetStorageTasksAsync(cancellationToken); + } + + /// + /// Lists all the storage tasks available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListBySubscription + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetStorageTasks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableStorageactionsSubscriptionResource(subscriptionResource).GetStorageTasks(cancellationToken); + } + + /// + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// + /// + /// Operation Id + /// StorageTasks_PreviewActions + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// or is null. + public static async Task> PreviewActionsStorageTaskAsync(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableStorageactionsSubscriptionResource(subscriptionResource).PreviewActionsStorageTaskAsync(location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); + } + + /// + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// + /// + /// Operation Id + /// StorageTasks_PreviewActions + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// or is null. + public static Response PreviewActionsStorageTask(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableStorageactionsSubscriptionResource(subscriptionResource).PreviewActionsStorageTask(location, storageTaskPreviewAction, cancellationToken); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Argument.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..2c7b78f23cd7 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..ea084dedc1e6 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingList.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..3350fe389580 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Storageactions +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..0bec8e1520f8 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Optional.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..d3b2fb9fd734 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.Storageactions +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..60c763fc4e5f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageTaskOperationSource.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageTaskOperationSource.cs new file mode 100644 index 000000000000..a1286fc060c3 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageTaskOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions +{ + internal class StorageTaskOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal StorageTaskOperationSource(ArmClient client) + { + _client = client; + } + + StorageTaskResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return new StorageTaskResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return new StorageTaskResource(_client, data); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperation.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperation.cs new file mode 100644 index 000000000000..4876fc957b9a --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Storageactions +{ +#pragma warning disable SA1649 // File name should match first type name + internal class StorageactionsArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of StorageactionsArmOperation for mocking. + protected StorageactionsArmOperation() + { + } + + internal StorageactionsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal StorageactionsArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "StorageactionsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperationOfT.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperationOfT.cs new file mode 100644 index 000000000000..6a0687eb83a2 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/LongRunningOperation/StorageactionsArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Storageactions +{ +#pragma warning disable SA1649 // File name should match first type name + internal class StorageactionsArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of StorageactionsArmOperation for mocking. + protected StorageactionsArmOperation() + { + } + + internal StorageactionsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal StorageactionsArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "StorageactionsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.Serialization.cs new file mode 100644 index 000000000000..e7919a710c40 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + internal partial class ElseCondition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElseCondition)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ElseCondition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElseCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElseCondition(document.RootElement, options); + } + + internal static ElseCondition DeserializeElseCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList operations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskOperation.DeserializeStorageTaskOperation(item, options)); + } + operations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ElseCondition(operations, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ElseCondition)} does not support writing '{options.Format}' format."); + } + } + + ElseCondition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeElseCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElseCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.cs new file mode 100644 index 000000000000..1f63f807a57b --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ElseCondition.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The else block of storage task operation. + internal partial class ElseCondition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of operations to execute in the else block. + /// is null. + public ElseCondition(IEnumerable operations) + { + Argument.AssertNotNull(operations, nameof(operations)); + + Operations = operations.ToList(); + } + + /// Initializes a new instance of . + /// List of operations to execute in the else block. + /// Keeps track of any properties unknown to the library. + internal ElseCondition(IList operations, IDictionary serializedAdditionalRawData) + { + Operations = operations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ElseCondition() + { + } + + /// List of operations to execute in the else block. + public IList Operations { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.Serialization.cs new file mode 100644 index 000000000000..f2c48cb2689b --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class IfCondition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IfCondition)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + IfCondition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IfCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIfCondition(document.RootElement, options); + } + + internal static IfCondition DeserializeIfCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string condition = default; + IList operations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("condition"u8)) + { + condition = property.Value.GetString(); + continue; + } + if (property.NameEquals("operations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskOperation.DeserializeStorageTaskOperation(item, options)); + } + operations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IfCondition(condition, operations, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(IfCondition)} does not support writing '{options.Format}' format."); + } + } + + IfCondition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIfCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IfCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.cs new file mode 100644 index 000000000000..c1933ce92dc6 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/IfCondition.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The if block of storage task operation. + public partial class IfCondition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Condition predicate to evaluate each object. See https://aka.ms/storagetaskconditions for valid properties and operators. + /// List of operations to execute when the condition predicate satisfies. + /// or is null. + public IfCondition(string condition, IEnumerable operations) + { + Argument.AssertNotNull(condition, nameof(condition)); + Argument.AssertNotNull(operations, nameof(operations)); + + Condition = condition; + Operations = operations.ToList(); + } + + /// Initializes a new instance of . + /// Condition predicate to evaluate each object. See https://aka.ms/storagetaskconditions for valid properties and operators. + /// List of operations to execute when the condition predicate satisfies. + /// Keeps track of any properties unknown to the library. + internal IfCondition(string condition, IList operations, IDictionary serializedAdditionalRawData) + { + Condition = condition; + Operations = operations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IfCondition() + { + } + + /// Condition predicate to evaluate each object. See https://aka.ms/storagetaskconditions for valid properties and operators. + public string Condition { get; set; } + /// List of operations to execute when the condition predicate satisfies. + public IList Operations { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/MatchedBlockName.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/MatchedBlockName.cs new file mode 100644 index 000000000000..616bf59bd2ce --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/MatchedBlockName.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents the condition block name that matched blob properties. + public readonly partial struct MatchedBlockName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MatchedBlockName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IfValue = "If"; + private const string ElseValue = "Else"; + private const string NoneValue = "None"; + + /// If. + public static MatchedBlockName If { get; } = new MatchedBlockName(IfValue); + /// Else. + public static MatchedBlockName Else { get; } = new MatchedBlockName(ElseValue); + /// None. + public static MatchedBlockName None { get; } = new MatchedBlockName(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(MatchedBlockName left, MatchedBlockName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MatchedBlockName left, MatchedBlockName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MatchedBlockName(string value) => new MatchedBlockName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MatchedBlockName other && Equals(other); + /// + public bool Equals(MatchedBlockName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnFailure.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnFailure.cs new file mode 100644 index 000000000000..b62679b2a80b --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnFailure.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Action to be taken when the operation fails for a object. + public readonly partial struct OnFailure : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnFailure(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BreakValue = "break"; + + /// break. + public static OnFailure Break { get; } = new OnFailure(BreakValue); + /// Determines if two values are the same. + public static bool operator ==(OnFailure left, OnFailure right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnFailure left, OnFailure right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OnFailure(string value) => new OnFailure(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnFailure other && Equals(other); + /// + public bool Equals(OnFailure other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnSuccess.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnSuccess.cs new file mode 100644 index 000000000000..4aa80d87daa4 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/OnSuccess.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Action to be taken when the operation is successful for a object. + public readonly partial struct OnSuccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnSuccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ContinueValue = "continue"; + + /// continue. + public static OnSuccess Continue { get; } = new OnSuccess(ContinueValue); + /// Determines if two values are the same. + public static bool operator ==(OnSuccess left, OnSuccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnSuccess left, OnSuccess right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OnSuccess(string value) => new OnSuccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnSuccess other && Equals(other); + /// + public bool Equals(OnSuccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.Serialization.cs new file mode 100644 index 000000000000..b6b29c68d2e7 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Storageactions.Models +{ + internal static partial class ProvisioningStateExtensions + { + public static string ToSerialString(this ProvisioningState value) => value switch + { + ProvisioningState.ValidateSubscriptionQuotaBegin => "ValidateSubscriptionQuotaBegin", + ProvisioningState.ValidateSubscriptionQuotaEnd => "ValidateSubscriptionQuotaEnd", + ProvisioningState.Creating => "Creating", + ProvisioningState.Succeeded => "Succeeded", + ProvisioningState.Deleting => "Deleting", + ProvisioningState.Canceled => "Canceled", + ProvisioningState.Failed => "Failed", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningState value.") + }; + + public static ProvisioningState ToProvisioningState(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "ValidateSubscriptionQuotaBegin")) return ProvisioningState.ValidateSubscriptionQuotaBegin; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "ValidateSubscriptionQuotaEnd")) return ProvisioningState.ValidateSubscriptionQuotaEnd; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Creating")) return ProvisioningState.Creating; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Succeeded")) return ProvisioningState.Succeeded; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Deleting")) return ProvisioningState.Deleting; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Canceled")) return ProvisioningState.Canceled; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Failed")) return ProvisioningState.Failed; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningState value."); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..3fc7f370a4fe --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents the provisioning state of the storage task. + public enum ProvisioningState + { + /// ValidateSubscriptionQuotaBegin. + ValidateSubscriptionQuotaBegin, + /// ValidateSubscriptionQuotaEnd. + ValidateSubscriptionQuotaEnd, + /// Creating. + Creating, + /// Succeeded. + Succeeded, + /// Deleting. + Deleting, + /// Canceled. + Canceled, + /// Failed. + Failed + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunResult.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunResult.cs new file mode 100644 index 000000000000..20ddc7ea5afa --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunResult.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents the overall result of the execution for the run instance. + public readonly partial struct RunResult : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunResult(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + + /// Succeeded. + public static RunResult Succeeded { get; } = new RunResult(SucceededValue); + /// Failed. + public static RunResult Failed { get; } = new RunResult(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(RunResult left, RunResult right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunResult left, RunResult right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RunResult(string value) => new RunResult(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunResult other && Equals(other); + /// + public bool Equals(RunResult other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunStatusEnum.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunStatusEnum.cs new file mode 100644 index 000000000000..4a9fa8c320ed --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/RunStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents the status of the execution. + public readonly partial struct RunStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "InProgress"; + private const string FinishedValue = "Finished"; + + /// InProgress. + public static RunStatusEnum InProgress { get; } = new RunStatusEnum(InProgressValue); + /// Finished. + public static RunStatusEnum Finished { get; } = new RunStatusEnum(FinishedValue); + /// Determines if two values are the same. + public static bool operator ==(RunStatusEnum left, RunStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunStatusEnum left, RunStatusEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RunStatusEnum(string value) => new RunStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunStatusEnum other && Equals(other); + /// + public bool Equals(RunStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.Serialization.cs new file mode 100644 index 000000000000..deb4143ff0c3 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("if"u8); + writer.WriteObjectValue(If, options); + if (Optional.IsDefined(Else)) + { + writer.WritePropertyName("else"u8); + writer.WriteObjectValue(Else, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskAction(document.RootElement, options); + } + + internal static StorageTaskAction DeserializeStorageTaskAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IfCondition @if = default; + ElseCondition @else = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("if"u8)) + { + @if = IfCondition.DeserializeIfCondition(property.Value, options); + continue; + } + if (property.NameEquals("else"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + @else = ElseCondition.DeserializeElseCondition(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskAction(@if, @else, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskAction)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.cs new file mode 100644 index 000000000000..5f1c0c9777a2 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAction.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The storage task action represents conditional statements and operations to be performed on target objects. + public partial class StorageTaskAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The if block of storage task operation. + /// is null. + public StorageTaskAction(IfCondition @if) + { + Argument.AssertNotNull(@if, nameof(@if)); + + If = @if; + } + + /// Initializes a new instance of . + /// The if block of storage task operation. + /// The else block of storage task operation. + /// Keeps track of any properties unknown to the library. + internal StorageTaskAction(IfCondition @if, ElseCondition @else, IDictionary serializedAdditionalRawData) + { + If = @if; + Else = @else; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskAction() + { + } + + /// The if block of storage task operation. + public IfCondition If { get; set; } + /// The else block of storage task operation. + internal ElseCondition Else { get; set; } + /// List of operations to execute in the else block. + public IList ElseOperations + { + get => Else is null ? default : Else.Operations; + set => Else = new ElseCondition(value); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs new file mode 100644 index 000000000000..24ec40a4f2ec --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + internal partial class StorageTaskAssignmentsListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskAssignmentsListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskAssignmentsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskAssignmentsListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskAssignmentsListResult(document.RootElement, options); + } + + internal static StorageTaskAssignmentsListResult DeserializeStorageTaskAssignmentsListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskAssignmentsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskAssignmentsListResult)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskAssignmentsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskAssignmentsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskAssignmentsListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.cs new file mode 100644 index 000000000000..c62c40477f6f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskAssignmentsListResult.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The response from the List Storage Tasks operation. + internal partial class StorageTaskAssignmentsListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal StorageTaskAssignmentsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of Storage Task Assignment Resource IDs associated with this Storage Task. + /// Request URL that can be used to query next page of Resource IDs. Returned when total number of requested Resource IDs exceed maximum page size. + /// Keeps track of any properties unknown to the library. + internal StorageTaskAssignmentsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of Storage Task Assignment Resource IDs associated with this Storage Task. + public IReadOnlyList Value { get; } + /// Request URL that can be used to query next page of Resource IDs. Returned when total number of requested Resource IDs exceed maximum page size. + public string NextLink { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.Serialization.cs new file mode 100644 index 000000000000..e1475b0b1755 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskOperation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskOperation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.ToString()); + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(OnSuccess)) + { + writer.WritePropertyName("onSuccess"u8); + writer.WriteStringValue(OnSuccess.Value.ToString()); + } + if (Optional.IsDefined(OnFailure)) + { + writer.WritePropertyName("onFailure"u8); + writer.WriteStringValue(OnFailure.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskOperation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskOperation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskOperation(document.RootElement, options); + } + + internal static StorageTaskOperation DeserializeStorageTaskOperation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StorageTaskOperationName name = default; + IDictionary parameters = default; + OnSuccess? onSuccess = default; + OnFailure? onFailure = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new StorageTaskOperationName(property.Value.GetString()); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property.NameEquals("onSuccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onSuccess = new OnSuccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("onFailure"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onFailure = new OnFailure(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskOperation(name, parameters ?? new ChangeTrackingDictionary(), onSuccess, onFailure, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskOperation)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskOperation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskOperation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.cs new file mode 100644 index 000000000000..120754ecc8f8 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperation.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents an operation to be performed on the object. + public partial class StorageTaskOperation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The operation to be performed on the object. + public StorageTaskOperation(StorageTaskOperationName name) + { + Name = name; + Parameters = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The operation to be performed on the object. + /// Key-value parameters for the operation. + /// Action to be taken when the operation is successful for a object. + /// Action to be taken when the operation fails for a object. + /// Keeps track of any properties unknown to the library. + internal StorageTaskOperation(StorageTaskOperationName name, IDictionary parameters, OnSuccess? onSuccess, OnFailure? onFailure, IDictionary serializedAdditionalRawData) + { + Name = name; + Parameters = parameters; + OnSuccess = onSuccess; + OnFailure = onFailure; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskOperation() + { + } + + /// The operation to be performed on the object. + public StorageTaskOperationName Name { get; set; } + /// Key-value parameters for the operation. + public IDictionary Parameters { get; } + /// Action to be taken when the operation is successful for a object. + public OnSuccess? OnSuccess { get; set; } + /// Action to be taken when the operation fails for a object. + public OnFailure? OnFailure { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperationName.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperationName.cs new file mode 100644 index 000000000000..d89cb7ad6c85 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskOperationName.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The operation to be performed on the object. + public readonly partial struct StorageTaskOperationName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StorageTaskOperationName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SetBlobTierValue = "SetBlobTier"; + private const string SetBlobTagsValue = "SetBlobTags"; + private const string SetBlobImmutabilityPolicyValue = "SetBlobImmutabilityPolicy"; + private const string SetBlobLegalHoldValue = "SetBlobLegalHold"; + private const string SetBlobExpiryValue = "SetBlobExpiry"; + private const string DeleteBlobValue = "DeleteBlob"; + private const string UndeleteBlobValue = "UndeleteBlob"; + + /// SetBlobTier. + public static StorageTaskOperationName SetBlobTier { get; } = new StorageTaskOperationName(SetBlobTierValue); + /// SetBlobTags. + public static StorageTaskOperationName SetBlobTags { get; } = new StorageTaskOperationName(SetBlobTagsValue); + /// SetBlobImmutabilityPolicy. + public static StorageTaskOperationName SetBlobImmutabilityPolicy { get; } = new StorageTaskOperationName(SetBlobImmutabilityPolicyValue); + /// SetBlobLegalHold. + public static StorageTaskOperationName SetBlobLegalHold { get; } = new StorageTaskOperationName(SetBlobLegalHoldValue); + /// SetBlobExpiry. + public static StorageTaskOperationName SetBlobExpiry { get; } = new StorageTaskOperationName(SetBlobExpiryValue); + /// DeleteBlob. + public static StorageTaskOperationName DeleteBlob { get; } = new StorageTaskOperationName(DeleteBlobValue); + /// UndeleteBlob. + public static StorageTaskOperationName UndeleteBlob { get; } = new StorageTaskOperationName(UndeleteBlobValue); + /// Determines if two values are the same. + public static bool operator ==(StorageTaskOperationName left, StorageTaskOperationName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StorageTaskOperationName left, StorageTaskOperationName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StorageTaskOperationName(string value) => new StorageTaskOperationName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StorageTaskOperationName other && Equals(other); + /// + public bool Equals(StorageTaskOperationName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.Serialization.cs new file mode 100644 index 000000000000..ee7e988c8686 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPatch(document.RootElement, options); + } + + internal static StorageTaskPatch DeserializeStorageTaskPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + IDictionary tags = default; + StorageTaskProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = StorageTaskProperties.DeserializeStorageTaskProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPatch(identity, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPatch)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.cs new file mode 100644 index 000000000000..3f9c3cfa5787 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPatch.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Parameters of the storage task update request. + public partial class StorageTaskPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The identity of the resource. + /// Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + /// Properties of the storage task. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPatch(ManagedServiceIdentity identity, IDictionary tags, StorageTaskProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The identity of the resource. + public ManagedServiceIdentity Identity { get; set; } + /// Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + public IDictionary Tags { get; } + /// Properties of the storage task. + public StorageTaskProperties Properties { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.Serialization.cs new file mode 100644 index 000000000000..e4a97ac27206 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewAction(document.RootElement, options); + } + + internal static StorageTaskPreviewAction DeserializeStorageTaskPreviewAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StorageTaskPreviewActionProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = StorageTaskPreviewActionProperties.DeserializeStorageTaskPreviewActionProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewAction(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewAction)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.cs new file mode 100644 index 000000000000..618bc2c66d81 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewAction.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage Task Preview Action. + public partial class StorageTaskPreviewAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Properties of the storage task preview. + /// is null. + public StorageTaskPreviewAction(StorageTaskPreviewActionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of . + /// Properties of the storage task preview. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewAction(StorageTaskPreviewActionProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskPreviewAction() + { + } + + /// Properties of the storage task preview. + public StorageTaskPreviewActionProperties Properties { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.Serialization.cs new file mode 100644 index 000000000000..a70aece68a62 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.Serialization.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewActionCondition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionCondition)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("if"u8); + writer.WriteObjectValue(If, options); + writer.WritePropertyName("elseBlockExists"u8); + writer.WriteBooleanValue(ElseBlockExists); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewActionCondition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewActionCondition(document.RootElement, options); + } + + internal static StorageTaskPreviewActionCondition DeserializeStorageTaskPreviewActionCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StorageTaskPreviewActionIfCondition @if = default; + bool elseBlockExists = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("if"u8)) + { + @if = StorageTaskPreviewActionIfCondition.DeserializeStorageTaskPreviewActionIfCondition(property.Value, options); + continue; + } + if (property.NameEquals("elseBlockExists"u8)) + { + elseBlockExists = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewActionCondition(@if, elseBlockExists, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionCondition)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewActionCondition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewActionCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.cs new file mode 100644 index 000000000000..3f072fa42e1c --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionCondition.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents the storage task conditions to be tested for a match with container and blob properties. + public partial class StorageTaskPreviewActionCondition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The condition to be tested for a match with container and blob properties. + /// Specify whether the else block is present in the condition. + /// is null. + public StorageTaskPreviewActionCondition(StorageTaskPreviewActionIfCondition @if, bool elseBlockExists) + { + Argument.AssertNotNull(@if, nameof(@if)); + + If = @if; + ElseBlockExists = elseBlockExists; + } + + /// Initializes a new instance of . + /// The condition to be tested for a match with container and blob properties. + /// Specify whether the else block is present in the condition. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewActionCondition(StorageTaskPreviewActionIfCondition @if, bool elseBlockExists, IDictionary serializedAdditionalRawData) + { + If = @if; + ElseBlockExists = elseBlockExists; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskPreviewActionCondition() + { + } + + /// The condition to be tested for a match with container and blob properties. + internal StorageTaskPreviewActionIfCondition If { get; set; } + /// Storage task condition to bes tested for a match. + public string IfCondition + { + get => If is null ? default : If.Condition; + set + { + if (If is null) + If = new StorageTaskPreviewActionIfCondition(); + If.Condition = value; + } + } + + /// Specify whether the else block is present in the condition. + public bool ElseBlockExists { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.Serialization.cs new file mode 100644 index 000000000000..d453154d3658 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.Serialization.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewActionIfCondition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionIfCondition)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewActionIfCondition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionIfCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewActionIfCondition(document.RootElement, options); + } + + internal static StorageTaskPreviewActionIfCondition DeserializeStorageTaskPreviewActionIfCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string condition = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("condition"u8)) + { + condition = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewActionIfCondition(condition, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionIfCondition)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewActionIfCondition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewActionIfCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionIfCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.cs new file mode 100644 index 000000000000..8b7bcbb2c362 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionIfCondition.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Represents storage task preview action condition. + public partial class StorageTaskPreviewActionIfCondition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskPreviewActionIfCondition() + { + } + + /// Initializes a new instance of . + /// Storage task condition to bes tested for a match. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewActionIfCondition(string condition, IDictionary serializedAdditionalRawData) + { + Condition = condition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Storage task condition to bes tested for a match. + public string Condition { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.Serialization.cs new file mode 100644 index 000000000000..29209b471a81 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewActionProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("container"u8); + writer.WriteObjectValue(Container, options); + writer.WritePropertyName("blobs"u8); + writer.WriteStartArray(); + foreach (var item in Blobs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewActionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewActionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewActionProperties(document.RootElement, options); + } + + internal static StorageTaskPreviewActionProperties DeserializeStorageTaskPreviewActionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StorageTaskPreviewContainerProperties container = default; + IList blobs = default; + StorageTaskPreviewActionCondition action = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("container"u8)) + { + container = StorageTaskPreviewContainerProperties.DeserializeStorageTaskPreviewContainerProperties(property.Value, options); + continue; + } + if (property.NameEquals("blobs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskPreviewBlobProperties.DeserializeStorageTaskPreviewBlobProperties(item, options)); + } + blobs = array; + continue; + } + if (property.NameEquals("action"u8)) + { + action = StorageTaskPreviewActionCondition.DeserializeStorageTaskPreviewActionCondition(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewActionProperties(container, blobs, action, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewActionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewActionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewActionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.cs new file mode 100644 index 000000000000..3debb2513bbc --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewActionProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage task preview action properties. + public partial class StorageTaskPreviewActionProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Properties of a sample container to test for a match with the preview action. + /// Properties of some sample blobs in the container to test for matches with the preview action. + /// Preview action to test. + /// , or is null. + public StorageTaskPreviewActionProperties(StorageTaskPreviewContainerProperties container, IEnumerable blobs, StorageTaskPreviewActionCondition action) + { + Argument.AssertNotNull(container, nameof(container)); + Argument.AssertNotNull(blobs, nameof(blobs)); + Argument.AssertNotNull(action, nameof(action)); + + Container = container; + Blobs = blobs.ToList(); + Action = action; + } + + /// Initializes a new instance of . + /// Properties of a sample container to test for a match with the preview action. + /// Properties of some sample blobs in the container to test for matches with the preview action. + /// Preview action to test. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewActionProperties(StorageTaskPreviewContainerProperties container, IList blobs, StorageTaskPreviewActionCondition action, IDictionary serializedAdditionalRawData) + { + Container = container; + Blobs = blobs; + Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskPreviewActionProperties() + { + } + + /// Properties of a sample container to test for a match with the preview action. + public StorageTaskPreviewContainerProperties Container { get; set; } + /// Properties of some sample blobs in the container to test for matches with the preview action. + public IList Blobs { get; } + /// Preview action to test. + public StorageTaskPreviewActionCondition Action { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.Serialization.cs new file mode 100644 index 000000000000..ede4a90617e2 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.Serialization.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewBlobProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewBlobProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartArray(); + foreach (var item in Tags) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(MatchedBlock)) + { + writer.WritePropertyName("matchedBlock"u8); + writer.WriteStringValue(MatchedBlock.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewBlobProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewBlobProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewBlobProperties(document.RootElement, options); + } + + internal static StorageTaskPreviewBlobProperties DeserializeStorageTaskPreviewBlobProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IList properties = default; + IList metadata = default; + IList tags = default; + MatchedBlockName? matchedBlock = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskPreviewKeyValueProperties.DeserializeStorageTaskPreviewKeyValueProperties(item, options)); + } + properties = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskPreviewKeyValueProperties.DeserializeStorageTaskPreviewKeyValueProperties(item, options)); + } + metadata = array; + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskPreviewKeyValueProperties.DeserializeStorageTaskPreviewKeyValueProperties(item, options)); + } + tags = array; + continue; + } + if (property.NameEquals("matchedBlock"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + matchedBlock = new MatchedBlockName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewBlobProperties( + name, + properties ?? new ChangeTrackingList(), + metadata ?? new ChangeTrackingList(), + tags ?? new ChangeTrackingList(), + matchedBlock, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewBlobProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewBlobProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewBlobProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewBlobProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.cs new file mode 100644 index 000000000000..625b78a186c0 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewBlobProperties.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage task preview container properties. + public partial class StorageTaskPreviewBlobProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskPreviewBlobProperties() + { + Properties = new ChangeTrackingList(); + Metadata = new ChangeTrackingList(); + Tags = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of test blob. + /// properties key value pairs to be tested for a match against the provided condition. + /// metadata key value pairs to be tested for a match against the provided condition. + /// tags key value pairs to be tested for a match against the provided condition. + /// Represents the condition block name that matched blob properties. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewBlobProperties(string name, IList properties, IList metadata, IList tags, MatchedBlockName? matchedBlock, IDictionary serializedAdditionalRawData) + { + Name = name; + Properties = properties; + Metadata = metadata; + Tags = tags; + MatchedBlock = matchedBlock; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of test blob. + public string Name { get; set; } + /// properties key value pairs to be tested for a match against the provided condition. + public IList Properties { get; } + /// metadata key value pairs to be tested for a match against the provided condition. + public IList Metadata { get; } + /// tags key value pairs to be tested for a match against the provided condition. + public IList Tags { get; } + /// Represents the condition block name that matched blob properties. + public MatchedBlockName? MatchedBlock { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.Serialization.cs new file mode 100644 index 000000000000..15d6c72fdb9d --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewContainerProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewContainerProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewContainerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewContainerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewContainerProperties(document.RootElement, options); + } + + internal static StorageTaskPreviewContainerProperties DeserializeStorageTaskPreviewContainerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IList metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskPreviewKeyValueProperties.DeserializeStorageTaskPreviewKeyValueProperties(item, options)); + } + metadata = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewContainerProperties(name, metadata ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewContainerProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewContainerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewContainerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewContainerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.cs new file mode 100644 index 000000000000..ea292b9d394c --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewContainerProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage task preview container properties. + public partial class StorageTaskPreviewContainerProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskPreviewContainerProperties() + { + Metadata = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of test container. + /// metadata key value pairs to be tested for a match against the provided condition. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewContainerProperties(string name, IList metadata, IDictionary serializedAdditionalRawData) + { + Name = name; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of test container. + public string Name { get; set; } + /// metadata key value pairs to be tested for a match against the provided condition. + public IList Metadata { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.Serialization.cs new file mode 100644 index 000000000000..f9208ece9d8d --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskPreviewKeyValueProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewKeyValueProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskPreviewKeyValueProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskPreviewKeyValueProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskPreviewKeyValueProperties(document.RootElement, options); + } + + internal static StorageTaskPreviewKeyValueProperties DeserializeStorageTaskPreviewKeyValueProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskPreviewKeyValueProperties(key, value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewKeyValueProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskPreviewKeyValueProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskPreviewKeyValueProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskPreviewKeyValueProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.cs new file mode 100644 index 000000000000..d2f507775856 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskPreviewKeyValueProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage task preview object key value pair properties. + public partial class StorageTaskPreviewKeyValueProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskPreviewKeyValueProperties() + { + } + + /// Initializes a new instance of . + /// Represents the key property of the pair. + /// Represents the value property of the pair. + /// Keeps track of any properties unknown to the library. + internal StorageTaskPreviewKeyValueProperties(string key, string value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Represents the key property of the pair. + public string Key { get; set; } + /// Represents the value property of the pair. + public string Value { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.Serialization.cs new file mode 100644 index 000000000000..e3e8482cc6a0 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(TaskVersion)) + { + writer.WritePropertyName("taskVersion"u8); + writer.WriteNumberValue(TaskVersion.Value); + } + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); + } + if (options.Format != "W" && Optional.IsDefined(CreationTimeInUtc)) + { + writer.WritePropertyName("creationTimeInUtc"u8); + writer.WriteStringValue(CreationTimeInUtc.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskProperties(document.RootElement, options); + } + + internal static StorageTaskProperties DeserializeStorageTaskProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? taskVersion = default; + bool enabled = default; + string description = default; + StorageTaskAction action = default; + ProvisioningState? provisioningState = default; + DateTimeOffset? creationTimeInUtc = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + taskVersion = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("enabled"u8)) + { + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("action"u8)) + { + action = StorageTaskAction.DeserializeStorageTaskAction(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property.Value.GetString().ToProvisioningState(); + continue; + } + if (property.NameEquals("creationTimeInUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTimeInUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskProperties( + taskVersion, + enabled, + description, + action, + provisioningState, + creationTimeInUtc, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.cs new file mode 100644 index 000000000000..d9e07362961f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskProperties.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Properties of the storage task. + public partial class StorageTaskProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Storage Task is enabled when set to true and disabled when set to false. + /// Text that describes the purpose of the storage task. + /// The storage task action that is executed. + /// or is null. + public StorageTaskProperties(bool enabled, string description, StorageTaskAction action) + { + Argument.AssertNotNull(description, nameof(description)); + Argument.AssertNotNull(action, nameof(action)); + + Enabled = enabled; + Description = description; + Action = action; + } + + /// Initializes a new instance of . + /// Storage task version. + /// Storage Task is enabled when set to true and disabled when set to false. + /// Text that describes the purpose of the storage task. + /// The storage task action that is executed. + /// Represents the provisioning state of the storage task. + /// The creation date and time of the storage task in UTC. + /// Keeps track of any properties unknown to the library. + internal StorageTaskProperties(long? taskVersion, bool enabled, string description, StorageTaskAction action, ProvisioningState? provisioningState, DateTimeOffset? creationTimeInUtc, IDictionary serializedAdditionalRawData) + { + TaskVersion = taskVersion; + Enabled = enabled; + Description = description; + Action = action; + ProvisioningState = provisioningState; + CreationTimeInUtc = creationTimeInUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskProperties() + { + } + + /// Storage task version. + public long? TaskVersion { get; } + /// Storage Task is enabled when set to true and disabled when set to false. + public bool Enabled { get; set; } + /// Text that describes the purpose of the storage task. + public string Description { get; set; } + /// The storage task action that is executed. + public StorageTaskAction Action { get; set; } + /// Represents the provisioning state of the storage task. + public ProvisioningState? ProvisioningState { get; } + /// The creation date and time of the storage task in UTC. + public DateTimeOffset? CreationTimeInUtc { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.Serialization.cs new file mode 100644 index 000000000000..0c5a7786ecb4 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskReportInstance : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportInstance)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskReportInstance IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportInstance)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskReportInstance(document.RootElement, options); + } + + internal static StorageTaskReportInstance DeserializeStorageTaskReportInstance(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StorageTaskReportProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = StorageTaskReportProperties.DeserializeStorageTaskReportProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskReportInstance( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskReportInstance)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskReportInstance IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskReportInstance(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskReportInstance)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.cs new file mode 100644 index 000000000000..3311ab1445d1 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportInstance.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage Tasks run report instance. + public partial class StorageTaskReportInstance : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskReportInstance() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Storage task execution report for a run instance. + /// Keeps track of any properties unknown to the library. + internal StorageTaskReportInstance(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StorageTaskReportProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Storage task execution report for a run instance. + public StorageTaskReportProperties Properties { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.Serialization.cs new file mode 100644 index 000000000000..fa8f0b2e9d39 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.Serialization.cs @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + public partial class StorageTaskReportProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(TaskAssignmentId)) + { + writer.WritePropertyName("taskAssignmentId"u8); + writer.WriteStringValue(TaskAssignmentId); + } + if (options.Format != "W" && Optional.IsDefined(StorageAccountId)) + { + writer.WritePropertyName("storageAccountId"u8); + writer.WriteStringValue(StorageAccountId); + } + if (options.Format != "W" && Optional.IsDefined(StartTime)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartTime); + } + if (options.Format != "W" && Optional.IsDefined(FinishTime)) + { + writer.WritePropertyName("finishTime"u8); + writer.WriteStringValue(FinishTime); + } + if (options.Format != "W" && Optional.IsDefined(ObjectsTargetedCount)) + { + writer.WritePropertyName("objectsTargetedCount"u8); + writer.WriteStringValue(ObjectsTargetedCount); + } + if (options.Format != "W" && Optional.IsDefined(ObjectsOperatedOnCount)) + { + writer.WritePropertyName("objectsOperatedOnCount"u8); + writer.WriteStringValue(ObjectsOperatedOnCount); + } + if (options.Format != "W" && Optional.IsDefined(ObjectFailedCount)) + { + writer.WritePropertyName("objectFailedCount"u8); + writer.WriteStringValue(ObjectFailedCount); + } + if (options.Format != "W" && Optional.IsDefined(ObjectsSucceededCount)) + { + writer.WritePropertyName("objectsSucceededCount"u8); + writer.WriteStringValue(ObjectsSucceededCount); + } + if (options.Format != "W" && Optional.IsDefined(RunStatusError)) + { + writer.WritePropertyName("runStatusError"u8); + writer.WriteStringValue(RunStatusError); + } + if (options.Format != "W" && Optional.IsDefined(RunStatusEnum)) + { + writer.WritePropertyName("runStatusEnum"u8); + writer.WriteStringValue(RunStatusEnum.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(SummaryReportPath)) + { + writer.WritePropertyName("summaryReportPath"u8); + writer.WriteStringValue(SummaryReportPath); + } + if (options.Format != "W" && Optional.IsDefined(TaskId)) + { + writer.WritePropertyName("taskId"u8); + writer.WriteStringValue(TaskId); + } + if (options.Format != "W" && Optional.IsDefined(TaskVersion)) + { + writer.WritePropertyName("taskVersion"u8); + writer.WriteStringValue(TaskVersion); + } + if (options.Format != "W" && Optional.IsDefined(RunResult)) + { + writer.WritePropertyName("runResult"u8); + writer.WriteStringValue(RunResult.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskReportProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskReportProperties(document.RootElement, options); + } + + internal static StorageTaskReportProperties DeserializeStorageTaskReportProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier taskAssignmentId = default; + ResourceIdentifier storageAccountId = default; + string startTime = default; + string finishTime = default; + string objectsTargetedCount = default; + string objectsOperatedOnCount = default; + string objectFailedCount = default; + string objectsSucceededCount = default; + string runStatusError = default; + RunStatusEnum? runStatusEnum = default; + string summaryReportPath = default; + ResourceIdentifier taskId = default; + string taskVersion = default; + RunResult? runResult = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskAssignmentId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + taskAssignmentId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageAccountId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime"u8)) + { + startTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("finishTime"u8)) + { + finishTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectsTargetedCount"u8)) + { + objectsTargetedCount = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectsOperatedOnCount"u8)) + { + objectsOperatedOnCount = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectFailedCount"u8)) + { + objectFailedCount = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectsSucceededCount"u8)) + { + objectsSucceededCount = property.Value.GetString(); + continue; + } + if (property.NameEquals("runStatusError"u8)) + { + runStatusError = property.Value.GetString(); + continue; + } + if (property.NameEquals("runStatusEnum"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runStatusEnum = new RunStatusEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("summaryReportPath"u8)) + { + summaryReportPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("taskId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + taskId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskVersion"u8)) + { + taskVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("runResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runResult = new RunResult(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskReportProperties( + taskAssignmentId, + storageAccountId, + startTime, + finishTime, + objectsTargetedCount, + objectsOperatedOnCount, + objectFailedCount, + objectsSucceededCount, + runStatusError, + runStatusEnum, + summaryReportPath, + taskId, + taskVersion, + runResult, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskReportProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskReportProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskReportProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskReportProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.cs new file mode 100644 index 000000000000..c21707b310a2 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportProperties.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Storage task execution report for a run instance. + public partial class StorageTaskReportProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskReportProperties() + { + } + + /// Initializes a new instance of . + /// Resource ID of the Storage Task Assignment associated with this reported run. + /// Resource ID of the Storage Account where this reported run executed. + /// Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects that meet the condition as defined in the storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Total number of objects where task operation succeeded when was attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + /// Well known Azure Storage error code that represents the error encountered during execution of the run instance. + /// Represents the status of the execution. + /// Full path to the verbose report stored in the reporting container as specified in the assignment execution context for the storage account. + /// Resource ID of the Storage Task applied during this run. + /// Storage Task Version. + /// Represents the overall result of the execution for the run instance. + /// Keeps track of any properties unknown to the library. + internal StorageTaskReportProperties(ResourceIdentifier taskAssignmentId, ResourceIdentifier storageAccountId, string startTime, string finishTime, string objectsTargetedCount, string objectsOperatedOnCount, string objectFailedCount, string objectsSucceededCount, string runStatusError, RunStatusEnum? runStatusEnum, string summaryReportPath, ResourceIdentifier taskId, string taskVersion, RunResult? runResult, IDictionary serializedAdditionalRawData) + { + TaskAssignmentId = taskAssignmentId; + StorageAccountId = storageAccountId; + StartTime = startTime; + FinishTime = finishTime; + ObjectsTargetedCount = objectsTargetedCount; + ObjectsOperatedOnCount = objectsOperatedOnCount; + ObjectFailedCount = objectFailedCount; + ObjectsSucceededCount = objectsSucceededCount; + RunStatusError = runStatusError; + RunStatusEnum = runStatusEnum; + SummaryReportPath = summaryReportPath; + TaskId = taskId; + TaskVersion = taskVersion; + RunResult = runResult; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource ID of the Storage Task Assignment associated with this reported run. + public ResourceIdentifier TaskAssignmentId { get; } + /// Resource ID of the Storage Account where this reported run executed. + public ResourceIdentifier StorageAccountId { get; } + /// Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string StartTime { get; } + /// End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string FinishTime { get; } + /// Total number of objects that meet the condition as defined in the storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string ObjectsTargetedCount { get; } + /// Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string ObjectsOperatedOnCount { get; } + /// Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string ObjectFailedCount { get; } + /// Total number of objects where task operation succeeded when was attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + public string ObjectsSucceededCount { get; } + /// Well known Azure Storage error code that represents the error encountered during execution of the run instance. + public string RunStatusError { get; } + /// Represents the status of the execution. + public RunStatusEnum? RunStatusEnum { get; } + /// Full path to the verbose report stored in the reporting container as specified in the assignment execution context for the storage account. + public string SummaryReportPath { get; } + /// Resource ID of the Storage Task applied during this run. + public ResourceIdentifier TaskId { get; } + /// Storage Task Version. + public string TaskVersion { get; } + /// Represents the overall result of the execution for the run instance. + public RunResult? RunResult { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs new file mode 100644 index 000000000000..d656d83fbcaf --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + internal partial class StorageTaskReportSummary : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportSummary)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskReportSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskReportSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskReportSummary(document.RootElement, options); + } + + internal static StorageTaskReportSummary DeserializeStorageTaskReportSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskReportInstance.DeserializeStorageTaskReportInstance(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskReportSummary(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskReportSummary)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskReportSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskReportSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskReportSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.cs new file mode 100644 index 000000000000..0c7b0fcd863f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTaskReportSummary.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// Fetch Storage Tasks Run Summary. + internal partial class StorageTaskReportSummary + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal StorageTaskReportSummary() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Gets storage tasks run result summary. + /// Request URL that can be used to query next page of storage task run results summary. Returned when the number of run instances and summary reports exceed maximum page size. + /// Keeps track of any properties unknown to the library. + internal StorageTaskReportSummary(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets storage tasks run result summary. + public IReadOnlyList Value { get; } + /// Request URL that can be used to query next page of storage task run results summary. Returned when the number of run instances and summary reports exceed maximum page size. + public string NextLink { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.Serialization.cs new file mode 100644 index 000000000000..a2a968e91a93 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Storageactions.Models +{ + internal partial class StorageTasksListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTasksListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTasksListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTasksListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTasksListResult(document.RootElement, options); + } + + internal static StorageTasksListResult DeserializeStorageTasksListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageTaskData.DeserializeStorageTaskData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTasksListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTasksListResult)} does not support writing '{options.Format}' format."); + } + } + + StorageTasksListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTasksListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTasksListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.cs new file mode 100644 index 000000000000..24d74f5b2f5f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/Models/StorageTasksListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Storageactions.Models +{ + /// The response from the List Storage Task operation. + internal partial class StorageTasksListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal StorageTasksListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Gets the list of storage tasks and their properties. + /// Request URL that can be used to query next page of storage tasks. Returned when total number of requested storage tasks exceed maximum page size. + /// Keeps track of any properties unknown to the library. + internal StorageTasksListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the list of storage tasks and their properties. + public IReadOnlyList Value { get; } + /// Request URL that can be used to query next page of storage tasks. Returned when total number of requested storage tasks exceed maximum page size. + public string NextLink { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ProviderConstants.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..102bb59da150 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Storageactions +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs new file mode 100644 index 000000000000..d8ecb68086cd --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + internal partial class StorageTaskAssignmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of StorageTaskAssignmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public StorageTaskAssignmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendPath("/storageTaskAssignments", false); + if (maxpagesize != null) + { + uri.AppendQuery("$maxpagesize", maxpagesize, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendPath("/storageTaskAssignments", false); + if (maxpagesize != null) + { + uri.AppendQuery("$maxpagesize", maxpagesize, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, storageTaskName, maxpagesize); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskAssignmentsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskAssignmentsListResult.DeserializeStorageTaskAssignmentsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, storageTaskName, maxpagesize); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskAssignmentsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskAssignmentsListResult.DeserializeStorageTaskAssignmentsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, storageTaskName, maxpagesize); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskAssignmentsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskAssignmentsListResult.DeserializeStorageTaskAssignmentsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, storageTaskName, maxpagesize); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskAssignmentsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskAssignmentsListResult.DeserializeStorageTaskAssignmentsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs new file mode 100644 index 000000000000..52b6083cb41d --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + internal partial class StorageTasksReportRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of StorageTasksReportRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public StorageTasksReportRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendPath("/reports", false); + if (maxpagesize != null) + { + uri.AppendQuery("$maxpagesize", maxpagesize, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendPath("/reports", false); + if (maxpagesize != null) + { + uri.AppendQuery("$maxpagesize", maxpagesize, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Fetch the storage tasks run report summary for each assignment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, storageTaskName, maxpagesize, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskReportSummary value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskReportSummary.DeserializeStorageTaskReportSummary(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Fetch the storage tasks run report summary for each assignment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, storageTaskName, maxpagesize, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskReportSummary value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskReportSummary.DeserializeStorageTaskReportSummary(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Fetch the storage tasks run report summary for each assignment. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, storageTaskName, maxpagesize, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskReportSummary value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskReportSummary.DeserializeStorageTaskReportSummary(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Fetch the storage tasks run report summary for each assignment. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string storageTaskName, string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, storageTaskName, maxpagesize, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskReportSummary value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskReportSummary.DeserializeStorageTaskReportSummary(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksRestOperations.cs new file mode 100644 index 000000000000..240e1b4dbfdb --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/RestOperations/StorageTasksRestOperations.cs @@ -0,0 +1,817 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + internal partial class StorageTasksRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of StorageTasksRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public StorageTasksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string storageTaskName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete the storage task resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete the storage task resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string storageTaskName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the storage task properties. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((StorageTaskData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the storage task properties. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((StorageTaskData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update storage task properties. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to provide to update the storage task resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update storage task properties. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to provide to update the storage task resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the storage tasks available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the storage tasks available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the storage tasks available under the given resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the storage tasks available under the given resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreatePreviewActionsRequestUri(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/previewActions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePreviewActionsRequest(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/previewActions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(storageTaskPreviewAction, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// The ID of the target subscription. The value must be an UUID. + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> PreviewActionsAsync(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTaskPreviewAction value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// The ID of the target subscription. The value must be an UUID. + /// The location to perform preview of the actions. + /// The parameters to preview action condition. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response PreviewActions(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTaskPreviewAction value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the storage tasks available under the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the storage tasks available under the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the storage tasks available under the given resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the storage tasks available under the given resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + StorageTasksListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskCollection.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskCollection.cs new file mode 100644 index 000000000000..21b4ce047b82 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Storageactions +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetStorageTasks method from an instance of . + /// + public partial class StorageTaskCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _storageTaskClientDiagnostics; + private readonly StorageTasksRestOperations _storageTaskRestClient; + + /// Initializes a new instance of the class for mocking. + protected StorageTaskCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal StorageTaskCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _storageTaskClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Storageactions", StorageTaskResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(StorageTaskResource.ResourceType, out string storageTaskApiVersion); + _storageTaskRestClient = new StorageTasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, storageTaskApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Create + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, data, cancellationToken).ConfigureAwait(false); + var operation = new StorageactionsArmOperation(new StorageTaskOperationSource(Client), _storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Create + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, data, cancellationToken); + var operation = new StorageactionsArmOperation(new StorageTaskOperationSource(Client), _storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.Get"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.Get"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the storage tasks available under the given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), _storageTaskClientDiagnostics, Pipeline, "StorageTaskCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the storage tasks available under the given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks + /// + /// + /// Operation Id + /// StorageTasks_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), _storageTaskClientDiagnostics, Pipeline, "StorageTaskCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.Exists"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.Exists"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageTaskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageTaskName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.Serialization.cs new file mode 100644 index 000000000000..483fbb0fa6da --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.Serialization.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + public partial class StorageTaskData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StorageTaskData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskData(document.RootElement, options); + } + + internal static StorageTaskData DeserializeStorageTaskData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + StorageTaskProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("properties"u8)) + { + properties = StorageTaskProperties.DeserializeStorageTaskProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + identity, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StorageTaskData)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStorageTaskData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.cs new file mode 100644 index 000000000000..d45e6e33b82d --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskData.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + /// + /// A class representing the StorageTask data model. + /// Represents Storage Task. + /// + public partial class StorageTaskData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The managed service identity of the resource. + /// Properties of the storage task. + /// or is null. + public StorageTaskData(AzureLocation location, ManagedServiceIdentity identity, StorageTaskProperties properties) : base(location) + { + Argument.AssertNotNull(identity, nameof(identity)); + Argument.AssertNotNull(properties, nameof(properties)); + + Identity = identity; + Properties = properties; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The managed service identity of the resource. + /// Properties of the storage task. + /// Keeps track of any properties unknown to the library. + internal StorageTaskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, StorageTaskProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Identity = identity; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StorageTaskData() + { + } + + /// The managed service identity of the resource. + public ManagedServiceIdentity Identity { get; set; } + /// Properties of the storage task. + public StorageTaskProperties Properties { get; set; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.Serialization.cs new file mode 100644 index 000000000000..4441f0da1b8c --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Storageactions +{ + public partial class StorageTaskResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + StorageTaskData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + StorageTaskData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.cs new file mode 100644 index 000000000000..7c55cd8b38ad --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Generated/StorageTaskResource.cs @@ -0,0 +1,828 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.Storageactions.Models; + +namespace Azure.ResourceManager.Storageactions +{ + /// + /// A Class representing a StorageTask along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetStorageTaskResource method. + /// Otherwise you can get one from its parent resource using the GetStorageTask method. + /// + public partial class StorageTaskResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageTaskName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageTaskName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _storageTaskClientDiagnostics; + private readonly StorageTasksRestOperations _storageTaskRestClient; + private readonly ClientDiagnostics _storageTaskAssignmentClientDiagnostics; + private readonly StorageTaskAssignmentRestOperations _storageTaskAssignmentRestClient; + private readonly ClientDiagnostics _storageTasksReportClientDiagnostics; + private readonly StorageTasksReportRestOperations _storageTasksReportRestClient; + private readonly StorageTaskData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.StorageActions/storageTasks"; + + /// Initializes a new instance of the class for mocking. + protected StorageTaskResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal StorageTaskResource(ArmClient client, StorageTaskData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal StorageTaskResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _storageTaskClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Storageactions", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string storageTaskApiVersion); + _storageTaskRestClient = new StorageTasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, storageTaskApiVersion); + _storageTaskAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Storageactions", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _storageTaskAssignmentRestClient = new StorageTaskAssignmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _storageTasksReportClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Storageactions", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _storageTasksReportRestClient = new StorageTasksReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual StorageTaskData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Get"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Get"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new StorageTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the storage task resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Delete + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Delete"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new StorageactionsArmOperation(_storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the storage task resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Delete + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Delete"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new StorageactionsArmOperation(_storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Update + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The parameters to provide to update the storage task resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, StorageTaskPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Update"); + scope.Start(); + try + { + var response = await _storageTaskRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new StorageactionsArmOperation(new StorageTaskOperationSource(Client), _storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update storage task properties + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Update + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The parameters to provide to update the storage task resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, StorageTaskPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.Update"); + scope.Start(); + try + { + var response = _storageTaskRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new StorageactionsArmOperation(new StorageTaskOperationSource(Client), _storageTaskClientDiagnostics, Pipeline, _storageTaskRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments + /// + /// + /// Operation Id + /// StorageTaskAssignment_List + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTaskAssignmentsAsync(string maxpagesize = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", cancellationToken); + } + + /// + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments + /// + /// + /// Operation Id + /// StorageTaskAssignment_List + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTaskAssignments(string maxpagesize = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", cancellationToken); + } + + /// + /// Fetch the storage tasks run report summary for each assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports + /// + /// + /// Operation Id + /// StorageTasksReport_List + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTasksReportsAsync(string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", cancellationToken); + } + + /// + /// Fetch the storage tasks run report summary for each assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports + /// + /// + /// Operation Id + /// StorageTasksReport_List + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// + /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTasksReports(string maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxpagesize, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", cancellationToken); + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new StorageTaskPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new StorageTaskPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new StorageTaskPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new StorageTaskPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _storageTaskRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new StorageTaskPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName} + /// + /// + /// Operation Id + /// StorageTasks_Get + /// + /// + /// Default Api Version + /// 2023-01-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _storageTaskClientDiagnostics.CreateScope("StorageTaskResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _storageTaskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new StorageTaskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new StorageTaskPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Properties/AssemblyInfo.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..71a8437bd8d4 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("storageactions")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.Storageactions.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/src/autorest.md b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/autorest.md new file mode 100644 index 000000000000..612a59d9fed8 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/src/autorest.md @@ -0,0 +1,56 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: storageactions +namespace: Azure.ResourceManager.storageactions +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storageactions/resource-manager/readme.md +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false +use-model-reader-writer: true + +#mgmt-debug: +# show-serialized-names: true + + + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs|ips + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4|ipv4 + Ipv6: IPv6|ipv6 + Ipsec: IPsec|ipsec + SSO: Sso + URI: Uri + Etag: ETag|etag + +``` diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/Azure.ResourceManager.Storageactions.Tests.csproj b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/Azure.ResourceManager.Storageactions.Tests.csproj new file mode 100644 index 000000000000..08e103d5a090 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/Azure.ResourceManager.Storageactions.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestBase.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestBase.cs new file mode 100644 index 000000000000..e9c1ba66f680 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestBase.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Storageactions.Tests +{ + public class storageactionsManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected storageactionsManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected storageactionsManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestEnvironment.cs b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestEnvironment.cs new file mode 100644 index 000000000000..a02ed1ceca4f --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.Storageactions/tests/storageactionsManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Storageactions.Tests +{ + public class storageactionsManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/storageactions/ci.mgmt.yml b/sdk/storageactions/ci.mgmt.yml new file mode 100644 index 000000000000..f938165b70aa --- /dev/null +++ b/sdk/storageactions/ci.mgmt.yml @@ -0,0 +1,24 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.mgmt.yml + - sdk/storageactions/Azure.ResourceManager.Storageactions/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storageactions + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.Storageactions + safeName: AzureResourceManagerStorageactions