diff --git a/doc/GeneratorMigration/Library_Inventory.md b/doc/GeneratorMigration/Library_Inventory.md index 0bdc0e385c1e..2080a7e81dc6 100644 --- a/doc/GeneratorMigration/Library_Inventory.md +++ b/doc/GeneratorMigration/Library_Inventory.md @@ -2,26 +2,27 @@ ## Summary -- Total libraries: 408 -- Management Plane (Swagger): 168 -- Management Plane (TSP-Old): 49 +- Total libraries: 412 +- Management Plane (Swagger): 167 +- Management Plane (TSP-Old): 52 - Management Plane (TypeSpec - @azure-typespec/http-client-csharp): 0 -- Management Plane (TypeSpec - @azure-typespec/http-client-csharp-mgmt): 2 +- Management Plane (TypeSpec - @azure-typespec/http-client-csharp-mgmt): 3 - Management Plane (TypeSpec - @typespec/http-client-csharp): 0 -- Data Plane (Swagger): 114 +- Data Plane (Swagger): 115 - Data Plane (TSP-Old): 27 -- Data Plane (TypeSpec - @azure-typespec/http-client-csharp): 7 +- Data Plane (TypeSpec - @azure-typespec/http-client-csharp): 8 - Data Plane (TypeSpec - @azure-typespec/http-client-csharp-mgmt): 0 - Data Plane (TypeSpec - @typespec/http-client-csharp): 2 -- No generator: 39 +- No generator: 38 ## Data Plane Libraries using TypeSpec (@azure-typespec/http-client-csharp) -TypeSpec with @azure-typespec/http-client-csharp generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp, or through special handling for specific libraries. Total: 7 +TypeSpec with @azure-typespec/http-client-csharp generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp, or through special handling for specific libraries. Total: 8 | Service | Library | Path | | ------- | ------- | ---- | +| ai | Azure.AI.VoiceLive | sdk/ai/Azure.AI.VoiceLive | | appconfiguration | Azure.Data.AppConfiguration | sdk/appconfiguration/Azure.Data.AppConfiguration | | eventgrid | Azure.Messaging.EventGrid.Namespaces | sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces | | eventgrid | Azure.Messaging.EventGrid.SystemEvents | sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents | @@ -78,7 +79,7 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f ## Data Plane Libraries using Swagger -Total: 114 +Total: 115 | Service | Library | Path | | ------- | ------- | ---- | @@ -142,7 +143,6 @@ Total: 114 | monitor | Azure.Monitor.Query | sdk/monitor/Azure.Monitor.Query | | objectanchors | Azure.MixedReality.ObjectAnchors.Conversion | sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion | | personalizer | Azure.AI.Personalizer | sdk/personalizer/Azure.AI.Personalizer | -| playwrighttesting | Azure.Developer.MicrosoftPlaywrightTesting.TestLogger | sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger | | provisioning | Azure.Provisioning | sdk/provisioning/Azure.Provisioning | | provisioning | Azure.Provisioning.AppConfiguration | sdk/provisioning/Azure.Provisioning.AppConfiguration | | provisioning | Azure.Provisioning.AppContainers | sdk/provisioning/Azure.Provisioning.AppContainers | @@ -158,6 +158,8 @@ Total: 114 | provisioning | Azure.Provisioning.KeyVault | sdk/provisioning/Azure.Provisioning.KeyVault | | provisioning | Azure.Provisioning.Kubernetes | sdk/provisioning/Azure.Provisioning.Kubernetes | | provisioning | Azure.Provisioning.KubernetesConfiguration | sdk/provisioning/Azure.Provisioning.KubernetesConfiguration | +| provisioning | Azure.Provisioning.Kusto | sdk/provisioning/Azure.Provisioning.Kusto | +| provisioning | Azure.Provisioning.Network | sdk/provisioning/Azure.Provisioning.Network | | provisioning | Azure.Provisioning.OperationalInsights | sdk/provisioning/Azure.Provisioning.OperationalInsights | | provisioning | Azure.Provisioning.PostgreSql | sdk/provisioning/Azure.Provisioning.PostgreSql | | provisioning | Azure.Provisioning.Redis | sdk/provisioning/Azure.Provisioning.Redis | @@ -200,17 +202,18 @@ Total: 114 ## Management Plane Libraries using TypeSpec (@azure-typespec/http-client-csharp-mgmt) -TypeSpec with @azure-typespec/http-client-csharp-mgmt generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp-mgmt, or through special handling for specific libraries. Total: 2 +TypeSpec with @azure-typespec/http-client-csharp-mgmt generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp-mgmt, or through special handling for specific libraries. Total: 3 | Service | Library | Path | | ------- | ------- | ---- | +| computerecommender | Azure.ResourceManager.Compute.Recommender | sdk/computerecommender/Azure.ResourceManager.Compute.Recommender | | portalservices | Azure.ResourceManager.PortalServicesCopilot | sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot | | storageactions | Azure.ResourceManager.StorageActions | sdk/storageactions/Azure.ResourceManager.StorageActions | ## Management Plane Libraries using TypeSpec (Old Generator) -TypeSpec with old generator is detected by the presence of a tsp-location.yaml file without an emitterPackageJsonPath value, tspconfig.yaml file, tsp directory, or *.tsp files. Total: 49 +TypeSpec with old generator is detected by the presence of a tsp-location.yaml file without an emitterPackageJsonPath value, tspconfig.yaml file, tsp directory, or *.tsp files. Total: 52 | Service | Library | Path | | ------- | ------- | ---- | @@ -225,11 +228,13 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f | connectedcache | Azure.ResourceManager.ConnectedCache | sdk/connectedcache/Azure.ResourceManager.ConnectedCache | | containerorchestratorruntime | Azure.ResourceManager.ContainerOrchestratorRuntime | sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime | | databasewatcher | Azure.ResourceManager.DatabaseWatcher | sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher | +| databox | Azure.ResourceManager.DataBox | sdk/databox/Azure.ResourceManager.DataBox | | dellstorage | Azure.ResourceManager.Dell.Storage | sdk/dellstorage/Azure.ResourceManager.Dell.Storage | | dependencymap | Azure.ResourceManager.DependencyMap | sdk/dependencymap/Azure.ResourceManager.DependencyMap | | deviceprovisioningservices | Azure.ResourceManager.DeviceProvisioningServices | sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices | | deviceregistry | Azure.ResourceManager.DeviceRegistry | sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry | | devopsinfrastructure | Azure.ResourceManager.DevOpsInfrastructure | sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure | +| disconnectedoperations | Azure.ResourceManager.DisconnectedOperations | sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations | | durabletask | Azure.ResourceManager.DurableTask | sdk/durabletask/Azure.ResourceManager.DurableTask | | elasticsan | Azure.ResourceManager.ElasticSan | sdk/elasticsan/Azure.ResourceManager.ElasticSan | | fabric | Azure.ResourceManager.Fabric | sdk/fabric/Azure.ResourceManager.Fabric | @@ -248,10 +253,10 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f | pineconevectordb | Azure.ResourceManager.PineconeVectorDB | sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDB | | planetarycomputer | Azure.ResourceManager.PlanetaryComputer | sdk/planetarycomputer/Azure.ResourceManager.PlanetaryComputer | | playwright | Azure.ResourceManager.Playwright | sdk/playwright/Azure.ResourceManager.Playwright | -| playwrighttesting | Azure.ResourceManager.PlaywrightTesting | sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting | | purestorageblock | Azure.ResourceManager.PureStorageBlock | sdk/purestorageblock/Azure.ResourceManager.PureStorageBlock | | recoveryservices | Azure.ResourceManager.RecoveryServices | sdk/recoveryservices/Azure.ResourceManager.RecoveryServices | | recoveryservices-datareplication | Azure.ResourceManager.RecoveryServicesDataReplication | sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication | +| resources | Azure.ResourceManager.Resources.Bicep | sdk/resources/Azure.ResourceManager.Resources.Bicep | | secretsstoreextension | Azure.ResourceManager.SecretsStoreExtension | sdk/secretsstoreextension/Azure.ResourceManager.SecretsStoreExtension | | selfhelp | Azure.ResourceManager.SelfHelp | sdk/selfhelp/Azure.ResourceManager.SelfHelp | | servicefabricmanagedclusters | Azure.ResourceManager.ServiceFabricManagedClusters | sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters | @@ -262,12 +267,13 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f | storagemover | Azure.ResourceManager.StorageMover | sdk/storagemover/Azure.ResourceManager.StorageMover | | terraform | Azure.ResourceManager.Terraform | sdk/terraform/Azure.ResourceManager.Terraform | | weightsandbiases | Azure.ResourceManager.WeightsAndBiases | sdk/weightsandbiases/Azure.ResourceManager.WeightsAndBiases | +| workloadorchestration | Azure.ResourceManager.WorkloadOrchestration | sdk/workloadorchestration/Azure.ResourceManager.WorkloadOrchestration | | workloadssapvirtualinstance | Azure.ResourceManager.WorkloadsSapVirtualInstance | sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance | ## Management Plane Libraries using Swagger -Total: 168 +Total: 167 | Service | Library | Path | | ------- | ------- | ---- | @@ -311,7 +317,6 @@ Total: 168 | cosmosdbforpostgresql | Azure.ResourceManager.CosmosDBForPostgreSql | sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql | | costmanagement | Azure.ResourceManager.CostManagement | sdk/costmanagement/Azure.ResourceManager.CostManagement | | customer-insights | Azure.ResourceManager.CustomerInsights | sdk/customer-insights/Azure.ResourceManager.CustomerInsights | -| databox | Azure.ResourceManager.DataBox | sdk/databox/Azure.ResourceManager.DataBox | | databoxedge | Azure.ResourceManager.DataBoxEdge | sdk/databoxedge/Azure.ResourceManager.DataBoxEdge | | datadog | Azure.ResourceManager.Datadog | sdk/datadog/Azure.ResourceManager.Datadog | | datafactory | Azure.ResourceManager.DataFactory | sdk/datafactory/Azure.ResourceManager.DataFactory | @@ -443,7 +448,7 @@ Total: 168 ## Libraries with No Generator -Libraries with no generator have neither autorest.md nor tsp-location.yaml files. Total: 39 +Libraries with no generator have neither autorest.md nor tsp-location.yaml files. Total: 38 | Service | Library | Path | | ------- | ------- | ---- | @@ -475,7 +480,6 @@ Libraries with no generator have neither autorest.md nor tsp-location.yaml files | loadtestservice | Azure.Developer.Playwright.NUnit | sdk/loadtestservice/Azure.Developer.Playwright.NUnit | | modelsrepository | Azure.IoT.ModelsRepository | sdk/modelsrepository/Azure.IoT.ModelsRepository | | monitor | Azure.Monitor.OpenTelemetry.AspNetCore | sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore | -| playwrighttesting | Azure.Developer.MicrosoftPlaywrightTesting.NUnit | sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.NUnit | | provisioning | Azure.Provisioning.Deployment | sdk/provisioning/Azure.Provisioning.Deployment | | provisioning | Generator | sdk/provisioning/Generator | | servicebus | Azure.Messaging.ServiceBus | sdk/servicebus/Azure.Messaging.ServiceBus | diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/Azure.ResourceManager.ComputeRecommender.sln b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/Azure.ResourceManager.Compute.Recommender.sln similarity index 92% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/Azure.ResourceManager.ComputeRecommender.sln rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/Azure.ResourceManager.Compute.Recommender.sln index 3fb96fcf8d71..3076787fff2c 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/Azure.ResourceManager.ComputeRecommender.sln +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/Azure.ResourceManager.Compute.Recommender.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ComputeRecommender", "src\Azure.ResourceManager.ComputeRecommender.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Compute.Recommender", "src\Azure.ResourceManager.Compute.Recommender.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ComputeRecommender.Tests", "tests\Azure.ResourceManager.ComputeRecommender.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Compute.Recommender.Tests", "tests\Azure.ResourceManager.Compute.Recommender.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/CHANGELOG.md b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/CHANGELOG.md similarity index 100% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/CHANGELOG.md rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/CHANGELOG.md diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/Directory.Build.props b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/Directory.Build.props similarity index 100% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/Directory.Build.props rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/Directory.Build.props diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/README.md b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/README.md similarity index 90% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/README.md rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/README.md index 5b787aefe176..c4b92402fa1c 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/README.md +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/README.md @@ -1,4 +1,4 @@ -# Microsoft Azure ComputeRecommender management client library for .NET +# Microsoft Azure Compute Recommender management client library for .NET The Microsoft Azure Compute Recommender provides recommendations to help you make informed decisions about deployment of your virtual machines. @@ -10,14 +10,14 @@ This library follows the [new Azure SDK guidelines](https://azure.github.io/azur - Better error-handling. - Support uniform telemetry across all languages. -## Getting started +## Getting started ### Install the package -Install the Microsoft Azure ComputeRecommender management library for .NET with [NuGet](https://www.nuget.org/): +Install the Microsoft Azure Compute Recommender management library for .NET with [NuGet](https://www.nuget.org/): ```dotnetcli -dotnet add package Azure.ResourceManager.ComputeRecommender --prerelease +dotnet add package Azure.ResourceManager.Compute.Recommender --prerelease ``` ### Prerequisites @@ -77,4 +77,4 @@ more information, see the [Code of Conduct FAQ][coc_faq] or contact [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 +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.net8.0.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.net8.0.cs new file mode 100644 index 000000000000..f18534c6bc52 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.net8.0.cs @@ -0,0 +1,135 @@ +namespace Azure.ResourceManager.Compute.Recommender +{ + public partial class AzureResourceManagerComputeRecommenderContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerComputeRecommenderContext() { } + public static Azure.ResourceManager.Compute.Recommender.AzureResourceManagerComputeRecommenderContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class ComputeRecommenderDiagnosticData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderDiagnosticData() { } + public System.Collections.Generic.IList ComputeRecommenderDiagnosticSupportedResourceTypes { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderDiagnosticResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComputeRecommenderDiagnosticResource() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response Generate(Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent spotPlacementScoresInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateAsync(Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent spotPlacementScoresInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class ComputeRecommenderExtensions + { + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } +} +namespace Azure.ResourceManager.Compute.Recommender.Mocking +{ + public partial class MockableComputeRecommenderArmClient : Azure.ResourceManager.ArmResource + { + protected MockableComputeRecommenderArmClient() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableComputeRecommenderSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableComputeRecommenderSubscriptionResource() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic() { throw null; } + } +} +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + public static partial class ArmComputeRecommenderModelFactory + { + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData ComputeRecommenderDiagnosticData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IList computeRecommenderDiagnosticSupportedResourceTypes = null) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent ComputeRecommenderGenerateContent(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?)) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult ComputeRecommenderGenerateResult(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?), System.Collections.Generic.IEnumerable placementScores = null) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = null, Azure.Core.AzureLocation? region = default(Azure.Core.AzureLocation?), string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } + } + public partial class ComputeRecommenderGenerateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeRecommenderGenerateContent() { } + public bool? AvailabilityZones { get { throw null; } set { } } + public int? DesiredCount { get { throw null; } set { } } + public System.Collections.Generic.IList DesiredLocations { get { throw null; } } + public System.Collections.Generic.IList DesiredSizes { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderGenerateResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderGenerateResult() { } + public bool? AvailabilityZones { get { throw null; } } + public int? DesiredCount { get { throw null; } } + public System.Collections.Generic.IList DesiredLocations { get { throw null; } } + public System.Collections.Generic.IList DesiredSizes { get { throw null; } } + public System.Collections.Generic.IList PlacementScores { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderPlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderPlacementScore() { } + public string AvailabilityZone { get { throw null; } } + public bool? IsQuotaAvailable { get { throw null; } } + public Azure.Core.AzureLocation? Region { get { throw null; } } + public string Score { get { throw null; } } + public string Sku { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeRecommenderResourceSize() { } + public string Sku { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.netstandard2.0.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.netstandard2.0.cs new file mode 100644 index 000000000000..f18534c6bc52 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/api/Azure.ResourceManager.Compute.Recommender.netstandard2.0.cs @@ -0,0 +1,135 @@ +namespace Azure.ResourceManager.Compute.Recommender +{ + public partial class AzureResourceManagerComputeRecommenderContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerComputeRecommenderContext() { } + public static Azure.ResourceManager.Compute.Recommender.AzureResourceManagerComputeRecommenderContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class ComputeRecommenderDiagnosticData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderDiagnosticData() { } + public System.Collections.Generic.IList ComputeRecommenderDiagnosticSupportedResourceTypes { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderDiagnosticResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComputeRecommenderDiagnosticResource() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response Generate(Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent spotPlacementScoresInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateAsync(Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent spotPlacementScoresInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class ComputeRecommenderExtensions + { + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } +} +namespace Azure.ResourceManager.Compute.Recommender.Mocking +{ + public partial class MockableComputeRecommenderArmClient : Azure.ResourceManager.ArmResource + { + protected MockableComputeRecommenderArmClient() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableComputeRecommenderSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableComputeRecommenderSubscriptionResource() { } + public virtual Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic() { throw null; } + } +} +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + public static partial class ArmComputeRecommenderModelFactory + { + public static Azure.ResourceManager.Compute.Recommender.ComputeRecommenderDiagnosticData ComputeRecommenderDiagnosticData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IList computeRecommenderDiagnosticSupportedResourceTypes = null) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent ComputeRecommenderGenerateContent(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?)) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult ComputeRecommenderGenerateResult(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?), System.Collections.Generic.IEnumerable placementScores = null) { throw null; } + public static Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = null, Azure.Core.AzureLocation? region = default(Azure.Core.AzureLocation?), string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } + } + public partial class ComputeRecommenderGenerateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeRecommenderGenerateContent() { } + public bool? AvailabilityZones { get { throw null; } set { } } + public int? DesiredCount { get { throw null; } set { } } + public System.Collections.Generic.IList DesiredLocations { get { throw null; } } + public System.Collections.Generic.IList DesiredSizes { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderGenerateResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderGenerateResult() { } + public bool? AvailabilityZones { get { throw null; } } + public int? DesiredCount { get { throw null; } } + public System.Collections.Generic.IList DesiredLocations { get { throw null; } } + public System.Collections.Generic.IList DesiredSizes { get { throw null; } } + public System.Collections.Generic.IList PlacementScores { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderGenerateResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderPlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ComputeRecommenderPlacementScore() { } + public string AvailabilityZone { get { throw null; } } + public bool? IsQuotaAvailable { get { throw null; } } + public Azure.Core.AzureLocation? Region { get { throw null; } } + public string Score { get { throw null; } } + public string Sku { get { throw null; } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ComputeRecommenderResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeRecommenderResourceSize() { } + public string Sku { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Recommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/assets.json b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/assets.json similarity index 89% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/assets.json rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/assets.json index ee2af75741e5..c41e695ae8fc 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/assets.json +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/assets.json @@ -2,6 +2,6 @@ { "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", - "TagPrefix": "net/computerecommender/Azure.ResourceManager.ComputeRecommender", + "TagPrefix": "net/computerecommender/Azure.ResourceManager.Compute.Recommender", "Tag": "" } diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Azure.ResourceManager.ComputeRecommender.csproj b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Azure.ResourceManager.Compute.Recommender.csproj similarity index 82% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Azure.ResourceManager.ComputeRecommender.csproj rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Azure.ResourceManager.Compute.Recommender.csproj index 10711430e25d..53801c37d39e 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Azure.ResourceManager.ComputeRecommender.csproj +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Azure.ResourceManager.Compute.Recommender.csproj @@ -3,6 +3,6 @@ Azure Resource Manager client SDK for Azure resource provider ComputeRecommender. 1.0.0-beta.1 azure;management;arm;resource manager;computerecommender - Azure.ResourceManager.ComputeRecommender + Azure.ResourceManager.Compute.Recommender diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ArmComputeRecommenderModelFactory.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ArmComputeRecommenderModelFactory.cs new file mode 100644 index 000000000000..96f129492821 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ArmComputeRecommenderModelFactory.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// A factory class for creating instances of the models for mocking. + public static partial class ArmComputeRecommenderModelFactory + { + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Describes what are the supported resource types for a diagnostic. + /// A new instance for mocking. + public static ComputeRecommenderDiagnosticData ComputeRecommenderDiagnosticData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IList computeRecommenderDiagnosticSupportedResourceTypes = default) + { + return new ComputeRecommenderDiagnosticData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + computeRecommenderDiagnosticSupportedResourceTypes is null ? default : new ComputeRecommenderDiagnosticProperties(computeRecommenderDiagnosticSupportedResourceTypes, new Dictionary())); + } + + /// SpotPlacementScores API Input. + /// The desired regions. + /// The desired virtual machine SKU sizes. + /// Desired instance count per region/zone based on the scope. + /// Defines if the scope is zonal or regional. + /// A new instance for mocking. + public static ComputeRecommenderGenerateContent ComputeRecommenderGenerateContent(IEnumerable desiredLocations = default, IEnumerable desiredSizes = default, int? desiredCount = default, bool? availabilityZones = default) + { + desiredLocations ??= new ChangeTrackingList(); + desiredSizes ??= new ChangeTrackingList(); + + return new ComputeRecommenderGenerateContent(desiredLocations.ToList(), desiredSizes.ToList(), desiredCount, availabilityZones, additionalBinaryDataProperties: null); + } + + /// SpotPlacementScores API response. + /// The desired regions. + /// The desired virtual machine SKU sizes. + /// Desired instance count per region/zone based on the scope. + /// Defines if the scope is zonal or regional. + /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. + /// A new instance for mocking. + public static ComputeRecommenderGenerateResult ComputeRecommenderGenerateResult(IEnumerable desiredLocations = default, IEnumerable desiredSizes = default, int? desiredCount = default, bool? availabilityZones = default, IEnumerable placementScores = default) + { + desiredLocations ??= new ChangeTrackingList(); + desiredSizes ??= new ChangeTrackingList(); + placementScores ??= new ChangeTrackingList(); + + return new ComputeRecommenderGenerateResult( + desiredLocations.ToList(), + desiredSizes.ToList(), + desiredCount, + availabilityZones, + placementScores.ToList(), + additionalBinaryDataProperties: null); + } + + /// The spot placement score for sku/region/zone combination. + /// The resource's CRP virtual machine SKU size. + /// The region. + /// The availability zone. + /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. + /// Whether the desired quota is available. + /// A new instance for mocking. + public static ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = default, AzureLocation? region = default, string availabilityZone = default, string score = default, bool? isQuotaAvailable = default) + { + return new ComputeRecommenderPlacementScore( + sku, + region, + availabilityZone, + score, + isQuotaAvailable, + additionalBinaryDataProperties: null); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.Serialization.cs new file mode 100644 index 000000000000..4b4e5a64b130 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// Contains metadata of a diagnostic type. + public partial class ComputeRecommenderDiagnosticData : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ComputeRecommenderDiagnosticData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComputeRecommenderDiagnosticData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderDiagnosticData DeserializeComputeRecommenderDiagnosticData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + ComputeRecommenderDiagnosticProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerComputeRecommenderContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ComputeRecommenderDiagnosticProperties.DeserializeComputeRecommenderDiagnosticProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ComputeRecommenderDiagnosticData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeRecommenderContext.Default); + default: + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ComputeRecommenderDiagnosticData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeComputeRecommenderDiagnosticData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ComputeRecommenderDiagnosticData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeComputeRecommenderDiagnosticData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.cs new file mode 100644 index 000000000000..573020f9db3e --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// Contains metadata of a diagnostic type. + public partial class ComputeRecommenderDiagnosticData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ComputeRecommenderDiagnosticData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Contains additional properties of a diagnostic. + internal ComputeRecommenderDiagnosticData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, ComputeRecommenderDiagnosticProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Contains additional properties of a diagnostic. + internal ComputeRecommenderDiagnosticProperties Properties { get; } + + /// Describes what are the supported resource types for a diagnostic. + public IList ComputeRecommenderDiagnosticSupportedResourceTypes + { + get + { + return Properties.SupportedResourceTypes; + } + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.Serialization.cs new file mode 100644 index 000000000000..5dfc94fb50db --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// + public partial class ComputeRecommenderDiagnosticResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ComputeRecommenderDiagnosticData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerComputeRecommenderContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerComputeRecommenderContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.cs new file mode 100644 index 000000000000..861351259b53 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/ComputeRecommenderDiagnosticResource.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute.Recommender.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// + /// A class representing a ComputeRecommenderDiagnostic along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetComputeRecommenderDiagnostic method. + /// + public partial class ComputeRecommenderDiagnosticResource : ArmResource + { + private readonly ClientDiagnostics _spotPlacementScoresClientDiagnostics; + private readonly SpotPlacementScores _spotPlacementScoresRestClient; + private readonly ComputeRecommenderDiagnosticData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Compute/locations/placementScores"; + + /// Initializes a new instance of ComputeRecommenderDiagnosticResource for mocking. + protected ComputeRecommenderDiagnosticResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ComputeRecommenderDiagnosticResource(ArmClient client, ComputeRecommenderDiagnosticData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ComputeRecommenderDiagnosticResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string computeRecommenderDiagnosticApiVersion); + _spotPlacementScoresClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Compute.Recommender", ResourceType.Namespace, Diagnostics); + _spotPlacementScoresRestClient = new SpotPlacementScores(_spotPlacementScoresClientDiagnostics, Pipeline, Endpoint, computeRecommenderDiagnosticApiVersion ?? "2025-06-05"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ComputeRecommenderDiagnosticData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The location. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) + { + string resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// Gets Spot Placement Scores metadata. + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _spotPlacementScoresClientDiagnostics.CreateScope("ComputeRecommenderDiagnosticResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _spotPlacementScoresRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ComputeRecommenderDiagnosticData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ComputeRecommenderDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets Spot Placement Scores metadata. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _spotPlacementScoresClientDiagnostics.CreateScope("ComputeRecommenderDiagnosticResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _spotPlacementScoresRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ComputeRecommenderDiagnosticData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ComputeRecommenderDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Generates placement scores for Spot VM skus. + /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> GenerateAsync(ComputeRecommenderGenerateContent spotPlacementScoresInput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(spotPlacementScoresInput, nameof(spotPlacementScoresInput)); + + using DiagnosticScope scope = _spotPlacementScoresClientDiagnostics.CreateScope("ComputeRecommenderDiagnosticResource.Generate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _spotPlacementScoresRestClient.CreateGenerateRequest(Guid.Parse(Id.SubscriptionId), Id.Name, ComputeRecommenderGenerateContent.ToRequestContent(spotPlacementScoresInput), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ComputeRecommenderGenerateResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Generates placement scores for Spot VM skus. + /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. + /// The cancellation token to use. + /// is null. + public virtual Response Generate(ComputeRecommenderGenerateContent spotPlacementScoresInput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(spotPlacementScoresInput, nameof(spotPlacementScoresInput)); + + using DiagnosticScope scope = _spotPlacementScoresClientDiagnostics.CreateScope("ComputeRecommenderDiagnosticResource.Generate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _spotPlacementScoresRestClient.CreateGenerateRequest(Guid.Parse(Id.SubscriptionId), Id.Name, ComputeRecommenderGenerateContent.ToRequestContent(spotPlacementScoresInput), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ComputeRecommenderGenerateResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs new file mode 100644 index 000000000000..51166f5f8c9d --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute.Recommender.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// A class to add extension methods to Azure.ResourceManager.Compute.Recommender. + public static partial class ComputeRecommenderExtensions + { + /// + private static MockableComputeRecommenderArmClient GetMockableComputeRecommenderArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableComputeRecommenderArmClient(client0, ResourceIdentifier.Root)); + } + + /// + private static MockableComputeRecommenderSubscriptionResource GetMockableComputeRecommenderSubscriptionResource(SubscriptionResource subscriptionResource) + { + return subscriptionResource.GetCachedClient(client => new MockableComputeRecommenderSubscriptionResource(client, subscriptionResource.Id)); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableComputeRecommenderArmClient(client).GetComputeRecommenderDiagnosticResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it in the . + /// The the method will execute against. + /// is null. + /// Returns a object. + public static ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableComputeRecommenderSubscriptionResource(subscriptionResource).GetComputeRecommenderDiagnostic(); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderArmClient.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderArmClient.cs new file mode 100644 index 000000000000..c2c8e95a6ead --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderArmClient.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Mocking +{ + /// A class to add extension methods to . + public partial class MockableComputeRecommenderArmClient : ArmResource + { + /// Initializes a new instance of MockableComputeRecommenderArmClient for mocking. + protected MockableComputeRecommenderArmClient() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableComputeRecommenderArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnosticResource(ResourceIdentifier id) + { + ComputeRecommenderDiagnosticResource.ValidateResourceId(id); + return new ComputeRecommenderDiagnosticResource(Client, id); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs new file mode 100644 index 000000000000..110484d982e1 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute.Recommender; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Compute.Recommender.Mocking +{ + /// A class to add extension methods to . + public partial class MockableComputeRecommenderSubscriptionResource : ArmResource + { + /// Initializes a new instance of MockableComputeRecommenderSubscriptionResource for mocking. + protected MockableComputeRecommenderSubscriptionResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableComputeRecommenderSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + /// Gets an object representing a along with the instance operations that can be performed on it in the . + /// Returns a object. + public virtual ComputeRecommenderDiagnosticResource GetComputeRecommenderDiagnostic() + { + return new ComputeRecommenderDiagnosticResource(Client, Id.AppendProviderResource("Microsoft.Compute", "locations", "spot")); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Argument.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..c3f6f45a9382 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Argument.cs @@ -0,0 +1,74 @@ +// 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.Compute.Recommender +{ + internal static partial class Argument + { + /// The value. + /// The name. + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The 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); + } + } + + /// The value. + /// The 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); + } + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingDictionary.cs similarity index 74% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingDictionary.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingDictionary.cs index 959547ab6d39..b1c419a2e208 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -9,9 +9,10 @@ using System.Collections; using System.Collections.Generic; -namespace Azure.ResourceManager.ComputeRecommender +namespace Azure.ResourceManager.Compute.Recommender { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingList.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingList.cs similarity index 76% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingList.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingList.cs index 00df66ae17e8..1c95c877e4f7 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ChangeTrackingList.cs @@ -10,9 +10,9 @@ using System.Collections.Generic; using System.Linq; -namespace Azure.ResourceManager.ComputeRecommender +namespace Azure.ResourceManager.Compute.Recommender { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..9b91b22bb109 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Compute.Recommender +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..4a39ff11cae6 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Compute.Recommender +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..10fefc0e3d34 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Compute.Recommender +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string propertySerializationName) + { + PropertyName = propertyName; + PropertySerializationName = propertySerializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string PropertySerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..5d16025a1cac --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Compute.Recommender +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..c2b4629a9f76 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Compute.Recommender +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ErrorResult.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..35c64ceb19cb --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.ResourceManager.Compute.Recommender +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ModelSerializationExtensions.cs similarity index 56% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ModelSerializationExtensions.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ModelSerializationExtensions.cs index ec8c3327d0c8..8179175bbfb8 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; -namespace Azure.ResourceManager.ComputeRecommender +namespace Azure.ResourceManager.Compute.Recommender { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Optional.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Optional.cs similarity index 91% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Optional.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Optional.cs index ac742756a122..6fa1bba815bc 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Optional.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Optional.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Text.Json; -namespace Azure.ResourceManager.ComputeRecommender +namespace Azure.ResourceManager.Compute.Recommender { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/RequestContextExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..1016dbe51072 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.Compute.Recommender +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/TypeFormatters.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..ae451eb43ccf --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.ResourceManager.Compute.Recommender +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string 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/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Utf8JsonRequestContent.cs similarity index 72% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Utf8JsonRequestContent.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Utf8JsonRequestContent.cs index b0a142c274c6..1eba7f2b5b98 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -11,9 +11,9 @@ using System.Threading.Tasks; using Azure.Core; -namespace Azure.ResourceManager.ComputeRecommender +namespace Azure.ResourceManager.Compute.Recommender { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs new file mode 100644 index 000000000000..890ad6b24aad --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using Azure.ResourceManager.Compute.Recommender.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute.Recommender +{ + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information + /// + [ModelReaderWriterBuildable(typeof(ComputeRecommenderDiagnosticData))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderDiagnosticProperties))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderDiagnosticResource))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderGenerateContent))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderGenerateResult))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderPlacementScore))] + [ModelReaderWriterBuildable(typeof(ComputeRecommenderResourceSize))] + [ModelReaderWriterBuildable(typeof(SystemData))] + public partial class AzureResourceManagerComputeRecommenderContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.Serialization.cs new file mode 100644 index 000000000000..ace62ceb7c39 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// Contains additional properties of a diagnostic. + internal partial class ComputeRecommenderDiagnosticProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticProperties)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(SupportedResourceTypes)) + { + writer.WritePropertyName("supportedResourceTypes"u8); + writer.WriteStartArray(); + foreach (string item in SupportedResourceTypes) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderDiagnosticProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComputeRecommenderDiagnosticProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderDiagnosticProperties DeserializeComputeRecommenderDiagnosticProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList supportedResourceTypes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("supportedResourceTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportedResourceTypes = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ComputeRecommenderDiagnosticProperties(supportedResourceTypes ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeRecommenderContext.Default); + default: + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderDiagnosticProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderDiagnosticProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeComputeRecommenderDiagnosticProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeRecommenderDiagnosticProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.cs new file mode 100644 index 000000000000..4a8cbd879ae4 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderDiagnosticProperties.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// Contains additional properties of a diagnostic. + internal partial class ComputeRecommenderDiagnosticProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ComputeRecommenderDiagnosticProperties() + { + SupportedResourceTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Describes what are the supported resource types for a diagnostic. + /// Keeps track of any properties unknown to the library. + internal ComputeRecommenderDiagnosticProperties(IList supportedResourceTypes, IDictionary additionalBinaryDataProperties) + { + SupportedResourceTypes = supportedResourceTypes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Describes what are the supported resource types for a diagnostic. + public IList SupportedResourceTypes { get; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.Serialization.cs new file mode 100644 index 000000000000..5313605376c8 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// SpotPlacementScores API Input. + public partial class ComputeRecommenderGenerateContent : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateContent)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(DesiredLocations)) + { + writer.WritePropertyName("desiredLocations"u8); + writer.WriteStartArray(); + foreach (AzureLocation item in DesiredLocations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DesiredSizes)) + { + writer.WritePropertyName("desiredSizes"u8); + writer.WriteStartArray(); + foreach (ComputeRecommenderResourceSize item in DesiredSizes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DesiredCount)) + { + writer.WritePropertyName("desiredCount"u8); + writer.WriteNumberValue(DesiredCount.Value); + } + if (Optional.IsDefined(AvailabilityZones)) + { + writer.WritePropertyName("availabilityZones"u8); + writer.WriteBooleanValue(AvailabilityZones.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderGenerateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderGenerateContent JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateContent)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComputeRecommenderGenerateContent(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderGenerateContent DeserializeComputeRecommenderGenerateContent(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList desiredLocations = default; + IList desiredSizes = default; + int? desiredCount = default; + bool? availabilityZones = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("desiredLocations"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + desiredLocations = array; + continue; + } + if (prop.NameEquals("desiredSizes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ComputeRecommenderResourceSize.DeserializeComputeRecommenderResourceSize(item, options)); + } + desiredSizes = array; + continue; + } + if (prop.NameEquals("desiredCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("availabilityZones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilityZones = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ComputeRecommenderGenerateContent(desiredLocations ?? new ChangeTrackingList(), desiredSizes ?? new ChangeTrackingList(), desiredCount, availabilityZones, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeRecommenderContext.Default); + default: + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateContent)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderGenerateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderGenerateContent PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeComputeRecommenderGenerateContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateContent)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ComputeRecommenderGenerateContent computeRecommenderGenerateContent) + { + if (computeRecommenderGenerateContent == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(computeRecommenderGenerateContent, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.cs new file mode 100644 index 000000000000..941d50fe0918 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// SpotPlacementScores API Input. + public partial class ComputeRecommenderGenerateContent + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ComputeRecommenderGenerateContent() + { + DesiredLocations = new ChangeTrackingList(); + DesiredSizes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The desired regions. + /// The desired virtual machine SKU sizes. + /// Desired instance count per region/zone based on the scope. + /// Defines if the scope is zonal or regional. + /// Keeps track of any properties unknown to the library. + internal ComputeRecommenderGenerateContent(IList desiredLocations, IList desiredSizes, int? desiredCount, bool? availabilityZones, IDictionary additionalBinaryDataProperties) + { + DesiredLocations = desiredLocations; + DesiredSizes = desiredSizes; + DesiredCount = desiredCount; + AvailabilityZones = availabilityZones; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The desired regions. + public IList DesiredLocations { get; } + + /// The desired virtual machine SKU sizes. + public IList DesiredSizes { get; } + + /// Desired instance count per region/zone based on the scope. + public int? DesiredCount { get; set; } + + /// Defines if the scope is zonal or regional. + public bool? AvailabilityZones { get; set; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.Serialization.cs new file mode 100644 index 000000000000..0c62e5f351a6 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.Serialization.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// SpotPlacementScores API response. + public partial class ComputeRecommenderGenerateResult : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateResult)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(DesiredLocations)) + { + writer.WritePropertyName("desiredLocations"u8); + writer.WriteStartArray(); + foreach (AzureLocation item in DesiredLocations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DesiredSizes)) + { + writer.WritePropertyName("desiredSizes"u8); + writer.WriteStartArray(); + foreach (ComputeRecommenderResourceSize item in DesiredSizes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DesiredCount)) + { + writer.WritePropertyName("desiredCount"u8); + writer.WriteNumberValue(DesiredCount.Value); + } + if (Optional.IsDefined(AvailabilityZones)) + { + writer.WritePropertyName("availabilityZones"u8); + writer.WriteBooleanValue(AvailabilityZones.Value); + } + if (Optional.IsCollectionDefined(PlacementScores)) + { + writer.WritePropertyName("placementScores"u8); + writer.WriteStartArray(); + foreach (ComputeRecommenderPlacementScore item in PlacementScores) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderGenerateResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderGenerateResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComputeRecommenderGenerateResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderGenerateResult DeserializeComputeRecommenderGenerateResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList desiredLocations = default; + IList desiredSizes = default; + int? desiredCount = default; + bool? availabilityZones = default; + IList placementScores = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("desiredLocations"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + desiredLocations = array; + continue; + } + if (prop.NameEquals("desiredSizes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ComputeRecommenderResourceSize.DeserializeComputeRecommenderResourceSize(item, options)); + } + desiredSizes = array; + continue; + } + if (prop.NameEquals("desiredCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("availabilityZones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilityZones = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("placementScores"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ComputeRecommenderPlacementScore.DeserializeComputeRecommenderPlacementScore(item, options)); + } + placementScores = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ComputeRecommenderGenerateResult( + desiredLocations ?? new ChangeTrackingList(), + desiredSizes ?? new ChangeTrackingList(), + desiredCount, + availabilityZones, + placementScores ?? new ChangeTrackingList(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeRecommenderContext.Default); + default: + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderGenerateResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderGenerateResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeComputeRecommenderGenerateResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeRecommenderGenerateResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ComputeRecommenderGenerateResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeComputeRecommenderGenerateResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.cs new file mode 100644 index 000000000000..2eb19ef48243 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderGenerateResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// SpotPlacementScores API response. + public partial class ComputeRecommenderGenerateResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ComputeRecommenderGenerateResult() + { + DesiredLocations = new ChangeTrackingList(); + DesiredSizes = new ChangeTrackingList(); + PlacementScores = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The desired regions. + /// The desired virtual machine SKU sizes. + /// Desired instance count per region/zone based on the scope. + /// Defines if the scope is zonal or regional. + /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. + /// Keeps track of any properties unknown to the library. + internal ComputeRecommenderGenerateResult(IList desiredLocations, IList desiredSizes, int? desiredCount, bool? availabilityZones, IList placementScores, IDictionary additionalBinaryDataProperties) + { + DesiredLocations = desiredLocations; + DesiredSizes = desiredSizes; + DesiredCount = desiredCount; + AvailabilityZones = availabilityZones; + PlacementScores = placementScores; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The desired regions. + public IList DesiredLocations { get; } + + /// The desired virtual machine SKU sizes. + public IList DesiredSizes { get; } + + /// Desired instance count per region/zone based on the scope. + public int? DesiredCount { get; } + + /// Defines if the scope is zonal or regional. + public bool? AvailabilityZones { get; } + + /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. + public IList PlacementScores { get; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs similarity index 55% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs index e12c54946a51..2fdf73462cf3 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; -namespace Azure.ResourceManager.ComputeRecommender.Models +namespace Azure.ResourceManager.Compute.Recommender.Models { - public partial class ComputeRecommenderPlacementScore : IUtf8JsonSerializable, IJsonModel + /// The spot placement score for sku/region/zone combination. + public partial class ComputeRecommenderPlacementScore : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ComputeRecommenderPlacementScore)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -59,15 +60,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("isQuotaAvailable"u8); writer.WriteBooleanValue(IsQuotaAvailable.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -76,22 +77,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ComputeRecommenderPlacementScore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderPlacementScore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderPlacementScore JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ComputeRecommenderPlacementScore)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeComputeRecommenderPlacementScore(document.RootElement, options); } - internal static ComputeRecommenderPlacementScore DeserializeComputeRecommenderPlacementScore(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderPlacementScore DeserializeComputeRecommenderPlacementScore(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,62 +107,63 @@ internal static ComputeRecommenderPlacementScore DeserializeComputeRecommenderPl string availabilityZone = default; string score = default; bool? isQuotaAvailable = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("sku"u8)) { - sku = property.Value.GetString(); + sku = prop.Value.GetString(); continue; } - if (property.NameEquals("region"u8)) + if (prop.NameEquals("region"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - region = new AzureLocation(property.Value.GetString()); + region = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("availabilityZone"u8)) + if (prop.NameEquals("availabilityZone"u8)) { - availabilityZone = property.Value.GetString(); + availabilityZone = prop.Value.GetString(); continue; } - if (property.NameEquals("score"u8)) + if (prop.NameEquals("score"u8)) { - score = property.Value.GetString(); + score = prop.Value.GetString(); continue; } - if (property.NameEquals("isQuotaAvailable"u8)) + if (prop.NameEquals("isQuotaAvailable"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - isQuotaAvailable = property.Value.GetBoolean(); + isQuotaAvailable = prop.Value.GetBoolean(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new ComputeRecommenderPlacementScore( sku, region, availabilityZone, score, isQuotaAvailable, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -166,15 +173,20 @@ BinaryData IPersistableModel.Write(ModelReader } } - ComputeRecommenderPlacementScore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderPlacementScore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderPlacementScore PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeComputeRecommenderPlacementScore(document.RootElement, options); } default: @@ -182,6 +194,7 @@ ComputeRecommenderPlacementScore IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs similarity index 56% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs index 2a44add88057..c6d9234be247 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderPlacementScore.cs @@ -9,42 +9,13 @@ using System.Collections.Generic; using Azure.Core; -namespace Azure.ResourceManager.ComputeRecommender.Models +namespace Azure.ResourceManager.Compute.Recommender.Models { /// The spot placement score for sku/region/zone combination. public partial class ComputeRecommenderPlacementScore { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal ComputeRecommenderPlacementScore() @@ -57,25 +28,29 @@ internal ComputeRecommenderPlacementScore() /// The availability zone. /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. /// Whether the desired quota is available. - /// Keeps track of any properties unknown to the library. - internal ComputeRecommenderPlacementScore(string sku, AzureLocation? region, string availabilityZone, string score, bool? isQuotaAvailable, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ComputeRecommenderPlacementScore(string sku, AzureLocation? region, string availabilityZone, string score, bool? isQuotaAvailable, IDictionary additionalBinaryDataProperties) { Sku = sku; Region = region; AvailabilityZone = availabilityZone; Score = score; IsQuotaAvailable = isQuotaAvailable; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource's CRP virtual machine SKU size. public string Sku { get; } + /// The region. public AzureLocation? Region { get; } + /// The availability zone. public string AvailabilityZone { get; } + /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. public string Score { get; } + /// Whether the desired quota is available. public bool? IsQuotaAvailable { get; } } diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs similarity index 50% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs index 6e0259bcecde..bb375289c96b 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Compute.Recommender; -namespace Azure.ResourceManager.ComputeRecommender.Models +namespace Azure.ResourceManager.Compute.Recommender.Models { - public partial class ComputeRecommenderResourceSize : IUtf8JsonSerializable, IJsonModel + /// SpotPlacementRecommender API response. + public partial class ComputeRecommenderResourceSize : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +29,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ComputeRecommenderResourceSize)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); writer.WriteStringValue(Sku); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,49 +56,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ComputeRecommenderResourceSize IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ComputeRecommenderResourceSize IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderResourceSize JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ComputeRecommenderResourceSize)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeComputeRecommenderResourceSize(document.RootElement, options); } - internal static ComputeRecommenderResourceSize DeserializeComputeRecommenderResourceSize(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeRecommenderResourceSize DeserializeComputeRecommenderResourceSize(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string sku = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("sku"u8)) { - sku = property.Value.GetString(); + sku = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ComputeRecommenderResourceSize(sku, serializedAdditionalRawData); + return new ComputeRecommenderResourceSize(sku, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -108,15 +114,20 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - ComputeRecommenderResourceSize IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ComputeRecommenderResourceSize IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeRecommenderResourceSize PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeComputeRecommenderResourceSize(document.RootElement, options); } default: @@ -124,6 +135,7 @@ ComputeRecommenderResourceSize IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.cs new file mode 100644 index 000000000000..50d98e517454 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/Models/ComputeRecommenderResourceSize.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.Recommender.Models +{ + /// SpotPlacementRecommender API response. + public partial class ComputeRecommenderResourceSize + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ComputeRecommenderResourceSize() + { + } + + /// Initializes a new instance of . + /// The resource's CRP virtual machine SKU size. + /// Keeps track of any properties unknown to the library. + internal ComputeRecommenderResourceSize(string sku, IDictionary additionalBinaryDataProperties) + { + Sku = sku; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The resource's CRP virtual machine SKU size. + public string Sku { get; set; } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs new file mode 100644 index 000000000000..c42eebd32adc --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Compute.Recommender +{ + internal partial class SpotPlacementScores + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SpotPlacementScores for mocking. + protected SpotPlacementScores() + { + } + + /// Initializes a new instance of SpotPlacementScores. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal SpotPlacementScores(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, AzureLocation location, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.Compute/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/placementScores/spot", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGenerateRequest(Guid subscriptionId, AzureLocation location, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.Compute/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/placementScores/spot/generate", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Properties/AssemblyInfo.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..bf77bf459282 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.Compute.Recommender.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namespace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Compute")] diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Azure.ResourceManager.ComputeRecommender.Tests.csproj b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/Azure.ResourceManager.Compute.Recommender.Tests.csproj similarity index 89% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Azure.ResourceManager.ComputeRecommender.Tests.csproj rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/Azure.ResourceManager.Compute.Recommender.Tests.csproj index 2bead0e536b1..6c817b0bcb5b 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Azure.ResourceManager.ComputeRecommender.Tests.csproj +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/Azure.ResourceManager.Compute.Recommender.Tests.csproj @@ -3,6 +3,6 @@ - + diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestBase.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestBase.cs similarity index 96% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestBase.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestBase.cs index dbbf762b0591..29741ccf344d 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestBase.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestBase.cs @@ -10,7 +10,7 @@ using NUnit.Framework; using System.Threading.Tasks; -namespace Azure.ResourceManager.ComputeRecommender.Tests +namespace Azure.ResourceManager.Compute.Recommender.Tests { public class ComputeRecommenderManagementTestBase : ManagementRecordedTestBase { diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestEnvironment.cs b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestEnvironment.cs similarity index 79% rename from sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestEnvironment.cs rename to sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestEnvironment.cs index 3a4606ef6c88..2530eabf9c68 100644 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/ComputeRecommenderManagementTestEnvironment.cs +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tests/ComputeRecommenderManagementTestEnvironment.cs @@ -3,7 +3,7 @@ using Azure.Core.TestFramework; -namespace Azure.ResourceManager.ComputeRecommender.Tests +namespace Azure.ResourceManager.Compute.Recommender.Tests { public class ComputeRecommenderManagementTestEnvironment : TestEnvironment { diff --git a/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tsp-location.yaml b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tsp-location.yaml new file mode 100644 index 000000000000..284e53e598d9 --- /dev/null +++ b/sdk/computerecommender/Azure.ResourceManager.Compute.Recommender/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/compute/resource-manager/Microsoft.Compute/RecommenderRP +commit: a61de433bd587bd7e9b65b7c95d6651f9f39e350 +repo: Azure/azure-rest-api-specs +additionalDirectories: +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.net8.0.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.net8.0.cs deleted file mode 100644 index 9a1aea490fb3..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.net8.0.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace Azure.ResourceManager.ComputeRecommender -{ - public partial class AzureResourceManagerComputeRecommenderContext : System.ClientModel.Primitives.ModelReaderWriterContext - { - internal AzureResourceManagerComputeRecommenderContext() { } - public static Azure.ResourceManager.ComputeRecommender.AzureResourceManagerComputeRecommenderContext Default { get { throw null; } } - protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } - } - public static partial class ComputeRecommenderExtensions - { - public static Azure.Response GetSpotPlacementScore(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetSpotPlacementScoreAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response PostSpotPlacementScore(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> PostSpotPlacementScoreAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } -} -namespace Azure.ResourceManager.ComputeRecommender.Mocking -{ - public partial class MockableComputeRecommenderSubscriptionResource : Azure.ResourceManager.ArmResource - { - protected MockableComputeRecommenderSubscriptionResource() { } - public virtual Azure.Response GetSpotPlacementScore(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetSpotPlacementScoreAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response PostSpotPlacementScore(Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> PostSpotPlacementScoreAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } -} -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - public static partial class ArmComputeRecommenderModelFactory - { - public static Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase ComputeDiagnosticBase(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable diagnosticSupportedResourceTypes = null) { throw null; } - public static Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = null, Azure.Core.AzureLocation? region = default(Azure.Core.AzureLocation?), string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } - public static Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult SpotPlacementScoresResult(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?), System.Collections.Generic.IEnumerable placementScores = null) { throw null; } - } - public partial class ComputeDiagnosticBase : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ComputeDiagnosticBase() { } - public System.Collections.Generic.IReadOnlyList DiagnosticSupportedResourceTypes { get { throw null; } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class ComputeRecommenderPlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ComputeRecommenderPlacementScore() { } - public string AvailabilityZone { get { throw null; } } - public bool? IsQuotaAvailable { get { throw null; } } - public Azure.Core.AzureLocation? Region { get { throw null; } } - public string Score { get { throw null; } } - public string Sku { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class ComputeRecommenderResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ComputeRecommenderResourceSize() { } - public string Sku { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class SpotPlacementScoresContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public SpotPlacementScoresContent() { } - public bool? AvailabilityZones { get { throw null; } set { } } - public int? DesiredCount { get { throw null; } set { } } - public System.Collections.Generic.IList DesiredLocations { get { throw null; } } - public System.Collections.Generic.IList DesiredSizes { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class SpotPlacementScoresResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal SpotPlacementScoresResult() { } - public bool? AvailabilityZones { get { throw null; } } - public int? DesiredCount { get { throw null; } } - public System.Collections.Generic.IReadOnlyList DesiredLocations { get { throw null; } } - public System.Collections.Generic.IReadOnlyList DesiredSizes { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PlacementScores { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.netstandard2.0.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.netstandard2.0.cs deleted file mode 100644 index 9a1aea490fb3..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/api/Azure.ResourceManager.ComputeRecommender.netstandard2.0.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace Azure.ResourceManager.ComputeRecommender -{ - public partial class AzureResourceManagerComputeRecommenderContext : System.ClientModel.Primitives.ModelReaderWriterContext - { - internal AzureResourceManagerComputeRecommenderContext() { } - public static Azure.ResourceManager.ComputeRecommender.AzureResourceManagerComputeRecommenderContext Default { get { throw null; } } - protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } - } - public static partial class ComputeRecommenderExtensions - { - public static Azure.Response GetSpotPlacementScore(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetSpotPlacementScoreAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response PostSpotPlacementScore(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> PostSpotPlacementScoreAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } -} -namespace Azure.ResourceManager.ComputeRecommender.Mocking -{ - public partial class MockableComputeRecommenderSubscriptionResource : Azure.ResourceManager.ArmResource - { - protected MockableComputeRecommenderSubscriptionResource() { } - public virtual Azure.Response GetSpotPlacementScore(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetSpotPlacementScoreAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response PostSpotPlacementScore(Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> PostSpotPlacementScoreAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } -} -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - public static partial class ArmComputeRecommenderModelFactory - { - public static Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase ComputeDiagnosticBase(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable diagnosticSupportedResourceTypes = null) { throw null; } - public static Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = null, Azure.Core.AzureLocation? region = default(Azure.Core.AzureLocation?), string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } - public static Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult SpotPlacementScoresResult(System.Collections.Generic.IEnumerable desiredLocations = null, System.Collections.Generic.IEnumerable desiredSizes = null, int? desiredCount = default(int?), bool? availabilityZones = default(bool?), System.Collections.Generic.IEnumerable placementScores = null) { throw null; } - } - public partial class ComputeDiagnosticBase : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ComputeDiagnosticBase() { } - public System.Collections.Generic.IReadOnlyList DiagnosticSupportedResourceTypes { get { throw null; } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeDiagnosticBase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class ComputeRecommenderPlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ComputeRecommenderPlacementScore() { } - public string AvailabilityZone { get { throw null; } } - public bool? IsQuotaAvailable { get { throw null; } } - public Azure.Core.AzureLocation? Region { get { throw null; } } - public string Score { get { throw null; } } - public string Sku { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderPlacementScore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class ComputeRecommenderResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ComputeRecommenderResourceSize() { } - public string Sku { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.ComputeRecommenderResourceSize System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class SpotPlacementScoresContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public SpotPlacementScoresContent() { } - public bool? AvailabilityZones { get { throw null; } set { } } - public int? DesiredCount { get { throw null; } set { } } - public System.Collections.Generic.IList DesiredLocations { get { throw null; } } - public System.Collections.Generic.IList DesiredSizes { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class SpotPlacementScoresResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal SpotPlacementScoresResult() { } - public bool? AvailabilityZones { get { throw null; } } - public int? DesiredCount { get { throw null; } } - public System.Collections.Generic.IReadOnlyList DesiredLocations { get { throw null; } } - public System.Collections.Generic.IReadOnlyList DesiredSizes { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PlacementScores { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.ComputeRecommender.Models.SpotPlacementScoresResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ArmComputeRecommenderModelFactory.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ArmComputeRecommenderModelFactory.cs deleted file mode 100644 index c980a9fdd0d0..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ArmComputeRecommenderModelFactory.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// Model factory for models. - public static partial class ArmComputeRecommenderModelFactory - { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Contains additional properties of a diagnostic. - /// A new instance for mocking. - public static ComputeDiagnosticBase ComputeDiagnosticBase(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable diagnosticSupportedResourceTypes = null) - { - diagnosticSupportedResourceTypes ??= new List(); - - return new ComputeDiagnosticBase( - id, - name, - resourceType, - systemData, - diagnosticSupportedResourceTypes != null ? new DiagnosticProperties(diagnosticSupportedResourceTypes?.ToList(), serializedAdditionalRawData: null) : null, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The desired regions. - /// The desired virtual machine SKU sizes. - /// Desired instance count per region/zone based on the scope. - /// Defines if the scope is zonal or regional. - /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. - /// A new instance for mocking. - public static SpotPlacementScoresResult SpotPlacementScoresResult(IEnumerable desiredLocations = null, IEnumerable desiredSizes = null, int? desiredCount = null, bool? availabilityZones = null, IEnumerable placementScores = null) - { - desiredLocations ??= new List(); - desiredSizes ??= new List(); - placementScores ??= new List(); - - return new SpotPlacementScoresResult( - desiredLocations?.ToList(), - desiredSizes?.ToList(), - desiredCount, - availabilityZones, - placementScores?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The resource's CRP virtual machine SKU size. - /// The region. - /// The availability zone. - /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. - /// Whether the desired quota is available. - /// A new instance for mocking. - public static ComputeRecommenderPlacementScore ComputeRecommenderPlacementScore(string sku = null, AzureLocation? region = null, string availabilityZone = null, string score = null, bool? isQuotaAvailable = null) - { - return new ComputeRecommenderPlacementScore( - sku, - region, - availabilityZone, - score, - isQuotaAvailable, - serializedAdditionalRawData: null); - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs deleted file mode 100644 index 4f51fd7e936a..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/ComputeRecommenderExtensions.cs +++ /dev/null @@ -1,156 +0,0 @@ -// 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.ComputeRecommender.Mocking; -using Azure.ResourceManager.ComputeRecommender.Models; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.ComputeRecommender -{ - /// A class to add extension methods to Azure.ResourceManager.ComputeRecommender. - public static partial class ComputeRecommenderExtensions - { - private static MockableComputeRecommenderSubscriptionResource GetMockableComputeRecommenderSubscriptionResource(ArmResource resource) - { - return resource.GetCachedClient(client => new MockableComputeRecommenderSubscriptionResource(client, resource.Id)); - } - - /// - /// Gets Spot Placement Scores metadata. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot - /// - /// - /// Operation Id - /// ComputeDiagnosticBase_Get - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - public static async Task> GetSpotPlacementScoreAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return await GetMockableComputeRecommenderSubscriptionResource(subscriptionResource).GetSpotPlacementScoreAsync(location, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets Spot Placement Scores metadata. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot - /// - /// - /// Operation Id - /// ComputeDiagnosticBase_Get - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - public static Response GetSpotPlacementScore(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableComputeRecommenderSubscriptionResource(subscriptionResource).GetSpotPlacementScore(location, cancellationToken); - } - - /// - /// Generates placement scores for Spot VM skus. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot/generate - /// - /// - /// Operation Id - /// ComputeDiagnosticBases_Post - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// or is null. - public static async Task> PostSpotPlacementScoreAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return await GetMockableComputeRecommenderSubscriptionResource(subscriptionResource).PostSpotPlacementScoreAsync(location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Generates placement scores for Spot VM skus. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot/generate - /// - /// - /// Operation Id - /// ComputeDiagnosticBases_Post - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// or is null. - public static Response PostSpotPlacementScore(this SubscriptionResource subscriptionResource, AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableComputeRecommenderSubscriptionResource(subscriptionResource).PostSpotPlacementScore(location, content, cancellationToken); - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs deleted file mode 100644 index f2f6d2951ee9..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Extensions/MockableComputeRecommenderSubscriptionResource.cs +++ /dev/null @@ -1,192 +0,0 @@ -// 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.Core.Pipeline; -using Azure.ResourceManager.ComputeRecommender.Models; - -namespace Azure.ResourceManager.ComputeRecommender.Mocking -{ - /// A class to add extension methods to SubscriptionResource. - public partial class MockableComputeRecommenderSubscriptionResource : ArmResource - { - private ClientDiagnostics _spotPlacementScoresClientDiagnostics; - private SpotPlacementScoresRestOperations _spotPlacementScoresRestClient; - - /// Initializes a new instance of the class for mocking. - protected MockableComputeRecommenderSubscriptionResource() - { - } - - /// 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 MockableComputeRecommenderSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics SpotPlacementScoresClientDiagnostics => _spotPlacementScoresClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ComputeRecommender", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SpotPlacementScoresRestOperations SpotPlacementScoresRestClient => _spotPlacementScoresRestClient ??= new SpotPlacementScoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets Spot Placement Scores metadata. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot - /// - /// - /// Operation Id - /// ComputeDiagnosticBase_Get - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - public virtual async Task> GetSpotPlacementScoreAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = SpotPlacementScoresClientDiagnostics.CreateScope("MockableComputeRecommenderSubscriptionResource.GetSpotPlacementScore"); - scope.Start(); - try - { - var response = await SpotPlacementScoresRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets Spot Placement Scores metadata. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot - /// - /// - /// Operation Id - /// ComputeDiagnosticBase_Get - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - public virtual Response GetSpotPlacementScore(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = SpotPlacementScoresClientDiagnostics.CreateScope("MockableComputeRecommenderSubscriptionResource.GetSpotPlacementScore"); - scope.Start(); - try - { - var response = SpotPlacementScoresRestClient.Get(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates placement scores for Spot VM skus. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot/generate - /// - /// - /// Operation Id - /// ComputeDiagnosticBases_Post - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> PostSpotPlacementScoreAsync(AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = SpotPlacementScoresClientDiagnostics.CreateScope("MockableComputeRecommenderSubscriptionResource.PostSpotPlacementScore"); - scope.Start(); - try - { - var response = await SpotPlacementScoresRestClient.PostAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates placement scores for Spot VM skus. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot/generate - /// - /// - /// Operation Id - /// ComputeDiagnosticBases_Post - /// - /// - /// Default Api Version - /// 2025-06-05 - /// - /// - /// - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// is null. - public virtual Response PostSpotPlacementScore(AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = SpotPlacementScoresClientDiagnostics.CreateScope("MockableComputeRecommenderSubscriptionResource.PostSpotPlacementScore"); - scope.Start(); - try - { - var response = SpotPlacementScoresRestClient.Post(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Argument.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Argument.cs deleted file mode 100644 index 899f912a896e..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Azure.ResourceManager.ComputeRecommender -{ - 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/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs deleted file mode 100644 index bc278c0cd2cd..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/AzureResourceManagerComputeRecommenderContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using Azure.ResourceManager.ComputeRecommender.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ComputeRecommender -{ - /// - /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' - /// - [ModelReaderWriterBuildable(typeof(ComputeDiagnosticBase))] - [ModelReaderWriterBuildable(typeof(ComputeRecommenderPlacementScore))] - [ModelReaderWriterBuildable(typeof(ComputeRecommenderResourceSize))] - [ModelReaderWriterBuildable(typeof(DiagnosticProperties))] - [ModelReaderWriterBuildable(typeof(ResponseError))] - [ModelReaderWriterBuildable(typeof(SpotPlacementScoresContent))] - [ModelReaderWriterBuildable(typeof(SpotPlacementScoresResult))] - [ModelReaderWriterBuildable(typeof(SystemData))] - public partial class AzureResourceManagerComputeRecommenderContext : ModelReaderWriterContext - { - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.Serialization.cs deleted file mode 100644 index 070d5c190426..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.Serialization.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - public partial class ComputeDiagnosticBase : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ComputeDiagnosticBase)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - } - } - - ComputeDiagnosticBase 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(ComputeDiagnosticBase)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeComputeDiagnosticBase(document.RootElement, options); - } - - internal static ComputeDiagnosticBase DeserializeComputeDiagnosticBase(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DiagnosticProperties 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 = DiagnosticProperties.DeserializeDiagnosticProperties(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 = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerComputeRecommenderContext.Default); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ComputeDiagnosticBase( - 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, AzureResourceManagerComputeRecommenderContext.Default); - default: - throw new FormatException($"The model {nameof(ComputeDiagnosticBase)} does not support writing '{options.Format}' format."); - } - } - - ComputeDiagnosticBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeComputeDiagnosticBase(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ComputeDiagnosticBase)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.cs deleted file mode 100644 index d9436b92cda3..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeDiagnosticBase.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// Contains metadata of a diagnostic type. - public partial class ComputeDiagnosticBase : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal ComputeDiagnosticBase() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Contains additional properties of a diagnostic. - /// Keeps track of any properties unknown to the library. - internal ComputeDiagnosticBase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DiagnosticProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Contains additional properties of a diagnostic. - internal DiagnosticProperties Properties { get; } - /// Describes what are the supported resource types for a diagnostic. - public IReadOnlyList DiagnosticSupportedResourceTypes - { - get => Properties?.SupportedResourceTypes; - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.cs deleted file mode 100644 index 9701c22414cb..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/ComputeRecommenderResourceSize.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// SpotPlacementRecommender API response. - public partial class ComputeRecommenderResourceSize - { - /// - /// 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 ComputeRecommenderResourceSize() - { - } - - /// Initializes a new instance of . - /// The resource's CRP virtual machine SKU size. - /// Keeps track of any properties unknown to the library. - internal ComputeRecommenderResourceSize(string sku, IDictionary serializedAdditionalRawData) - { - Sku = sku; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The resource's CRP virtual machine SKU size. - public string Sku { get; set; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.Serialization.cs deleted file mode 100644 index 169aaede3e6c..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - internal partial class DiagnosticProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DiagnosticProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(SupportedResourceTypes)) - { - writer.WritePropertyName("supportedResourceTypes"u8); - writer.WriteStartArray(); - foreach (var item in SupportedResourceTypes) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - DiagnosticProperties 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(DiagnosticProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDiagnosticProperties(document.RootElement, options); - } - - internal static DiagnosticProperties DeserializeDiagnosticProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList supportedResourceTypes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("supportedResourceTypes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - supportedResourceTypes = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DiagnosticProperties(supportedResourceTypes ?? 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, AzureResourceManagerComputeRecommenderContext.Default); - default: - throw new FormatException($"The model {nameof(DiagnosticProperties)} does not support writing '{options.Format}' format."); - } - } - - DiagnosticProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDiagnosticProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DiagnosticProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.cs deleted file mode 100644 index 9f5e982abbfc..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/DiagnosticProperties.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// Contains additional properties of a diagnostic. - internal partial class DiagnosticProperties - { - /// - /// 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 DiagnosticProperties() - { - SupportedResourceTypes = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Describes what are the supported resource types for a diagnostic. - /// Keeps track of any properties unknown to the library. - internal DiagnosticProperties(IReadOnlyList supportedResourceTypes, IDictionary serializedAdditionalRawData) - { - SupportedResourceTypes = supportedResourceTypes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Describes what are the supported resource types for a diagnostic. - public IReadOnlyList SupportedResourceTypes { get; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs deleted file mode 100644 index 379a964a7f0a..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - public partial class SpotPlacementScoresContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SpotPlacementScoresContent)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(DesiredLocations)) - { - writer.WritePropertyName("desiredLocations"u8); - writer.WriteStartArray(); - foreach (var item in DesiredLocations) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(DesiredSizes)) - { - writer.WritePropertyName("desiredSizes"u8); - writer.WriteStartArray(); - foreach (var item in DesiredSizes) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(DesiredCount)) - { - writer.WritePropertyName("desiredCount"u8); - writer.WriteNumberValue(DesiredCount.Value); - } - if (Optional.IsDefined(AvailabilityZones)) - { - writer.WritePropertyName("availabilityZones"u8); - writer.WriteBooleanValue(AvailabilityZones.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SpotPlacementScoresContent 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(SpotPlacementScoresContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSpotPlacementScoresContent(document.RootElement, options); - } - - internal static SpotPlacementScoresContent DeserializeSpotPlacementScoresContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList desiredLocations = default; - IList desiredSizes = default; - int? desiredCount = default; - bool? availabilityZones = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("desiredLocations"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new AzureLocation(item.GetString())); - } - desiredLocations = array; - continue; - } - if (property.NameEquals("desiredSizes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ComputeRecommenderResourceSize.DeserializeComputeRecommenderResourceSize(item, options)); - } - desiredSizes = array; - continue; - } - if (property.NameEquals("desiredCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - desiredCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("availabilityZones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityZones = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SpotPlacementScoresContent(desiredLocations ?? new ChangeTrackingList(), desiredSizes ?? new ChangeTrackingList(), desiredCount, availabilityZones, 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, AzureResourceManagerComputeRecommenderContext.Default); - default: - throw new FormatException($"The model {nameof(SpotPlacementScoresContent)} does not support writing '{options.Format}' format."); - } - } - - SpotPlacementScoresContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSpotPlacementScoresContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SpotPlacementScoresContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.cs deleted file mode 100644 index 846a335aab31..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresContent.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// SpotPlacementScores API Input. - public partial class SpotPlacementScoresContent - { - /// - /// 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 SpotPlacementScoresContent() - { - DesiredLocations = new ChangeTrackingList(); - DesiredSizes = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The desired regions. - /// The desired virtual machine SKU sizes. - /// Desired instance count per region/zone based on the scope. - /// Defines if the scope is zonal or regional. - /// Keeps track of any properties unknown to the library. - internal SpotPlacementScoresContent(IList desiredLocations, IList desiredSizes, int? desiredCount, bool? availabilityZones, IDictionary serializedAdditionalRawData) - { - DesiredLocations = desiredLocations; - DesiredSizes = desiredSizes; - DesiredCount = desiredCount; - AvailabilityZones = availabilityZones; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The desired regions. - public IList DesiredLocations { get; } - /// The desired virtual machine SKU sizes. - public IList DesiredSizes { get; } - /// Desired instance count per region/zone based on the scope. - public int? DesiredCount { get; set; } - /// Defines if the scope is zonal or regional. - public bool? AvailabilityZones { get; set; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.Serialization.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.Serialization.cs deleted file mode 100644 index 9769539797b4..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.Serialization.cs +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - public partial class SpotPlacementScoresResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SpotPlacementScoresResult)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(DesiredLocations)) - { - writer.WritePropertyName("desiredLocations"u8); - writer.WriteStartArray(); - foreach (var item in DesiredLocations) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(DesiredSizes)) - { - writer.WritePropertyName("desiredSizes"u8); - writer.WriteStartArray(); - foreach (var item in DesiredSizes) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(DesiredCount)) - { - writer.WritePropertyName("desiredCount"u8); - writer.WriteNumberValue(DesiredCount.Value); - } - if (Optional.IsDefined(AvailabilityZones)) - { - writer.WritePropertyName("availabilityZones"u8); - writer.WriteBooleanValue(AvailabilityZones.Value); - } - if (Optional.IsCollectionDefined(PlacementScores)) - { - writer.WritePropertyName("placementScores"u8); - writer.WriteStartArray(); - foreach (var item in PlacementScores) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SpotPlacementScoresResult 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(SpotPlacementScoresResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSpotPlacementScoresResult(document.RootElement, options); - } - - internal static SpotPlacementScoresResult DeserializeSpotPlacementScoresResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList desiredLocations = default; - IReadOnlyList desiredSizes = default; - int? desiredCount = default; - bool? availabilityZones = default; - IReadOnlyList placementScores = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("desiredLocations"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new AzureLocation(item.GetString())); - } - desiredLocations = array; - continue; - } - if (property.NameEquals("desiredSizes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ComputeRecommenderResourceSize.DeserializeComputeRecommenderResourceSize(item, options)); - } - desiredSizes = array; - continue; - } - if (property.NameEquals("desiredCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - desiredCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("availabilityZones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityZones = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("placementScores"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ComputeRecommenderPlacementScore.DeserializeComputeRecommenderPlacementScore(item, options)); - } - placementScores = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SpotPlacementScoresResult( - desiredLocations ?? new ChangeTrackingList(), - desiredSizes ?? new ChangeTrackingList(), - desiredCount, - availabilityZones, - placementScores ?? 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, AzureResourceManagerComputeRecommenderContext.Default); - default: - throw new FormatException($"The model {nameof(SpotPlacementScoresResult)} does not support writing '{options.Format}' format."); - } - } - - SpotPlacementScoresResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSpotPlacementScoresResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SpotPlacementScoresResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.cs deleted file mode 100644 index 78d2f27096ec..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/Models/SpotPlacementScoresResult.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.ComputeRecommender.Models -{ - /// SpotPlacementScores API response. - public partial class SpotPlacementScoresResult - { - /// - /// 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 SpotPlacementScoresResult() - { - DesiredLocations = new ChangeTrackingList(); - DesiredSizes = new ChangeTrackingList(); - PlacementScores = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The desired regions. - /// The desired virtual machine SKU sizes. - /// Desired instance count per region/zone based on the scope. - /// Defines if the scope is zonal or regional. - /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. - /// Keeps track of any properties unknown to the library. - internal SpotPlacementScoresResult(IReadOnlyList desiredLocations, IReadOnlyList desiredSizes, int? desiredCount, bool? availabilityZones, IReadOnlyList placementScores, IDictionary serializedAdditionalRawData) - { - DesiredLocations = desiredLocations; - DesiredSizes = desiredSizes; - DesiredCount = desiredCount; - AvailabilityZones = availabilityZones; - PlacementScores = placementScores; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The desired regions. - public IReadOnlyList DesiredLocations { get; } - /// The desired virtual machine SKU sizes. - public IReadOnlyList DesiredSizes { get; } - /// Desired instance count per region/zone based on the scope. - public int? DesiredCount { get; } - /// Defines if the scope is zonal or regional. - public bool? AvailabilityZones { get; } - /// A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation. - public IReadOnlyList PlacementScores { get; } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ProviderConstants.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ProviderConstants.cs deleted file mode 100644 index 659bbb4c6ebf..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/ProviderConstants.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.ComputeRecommender -{ - internal static class ProviderConstants - { - public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs deleted file mode 100644 index f9ae6972b126..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs +++ /dev/null @@ -1,215 +0,0 @@ -// 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.ComputeRecommender.Models; - -namespace Azure.ResourceManager.ComputeRecommender -{ - internal partial class SpotPlacementScoresRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of SpotPlacementScoresRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public SpotPlacementScoresRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-06-05"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Compute/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/placementScores/spot", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Compute/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/placementScores/spot", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets Spot Placement Scores metadata. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ComputeDiagnosticBase value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ComputeDiagnosticBase.DeserializeComputeDiagnosticBase(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets Spot Placement Scores metadata. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ComputeDiagnosticBase value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ComputeDiagnosticBase.DeserializeComputeDiagnosticBase(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, AzureLocation location, SpotPlacementScoresContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Compute/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/placementScores/spot/generate", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePostRequest(string subscriptionId, AzureLocation location, SpotPlacementScoresContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Compute/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/placementScores/spot/generate", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Generates placement scores for Spot VM skus. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> PostAsync(string subscriptionId, AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePostRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SpotPlacementScoresResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SpotPlacementScoresResult.DeserializeSpotPlacementScoresResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Generates placement scores for Spot VM skus. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response Post(string subscriptionId, AzureLocation location, SpotPlacementScoresContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePostRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SpotPlacementScoresResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SpotPlacementScoresResult.DeserializeSpotPlacementScoresResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Properties/AssemblyInfo.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 1c4e5b64f439..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Azure.ResourceManager.ComputeRecommender.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] - -// Replace Microsoft.Test with the correct resource provider namespace for your service and uncomment. -// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers -// for the list of possible values. -[assembly: Azure.Core.AzureResourceProviderNamespace("ComputeRecommender")] diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs deleted file mode 100644 index 86663b0f529a..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.ComputeRecommender.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.ComputeRecommender.Samples -{ - public partial class Sample_SubscriptionResourceExtensions - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetSpotPlacementScore_GetsTheMetadataOfSpotPlacementScores() - { - // Generated from example definition: 2025-06-05/GetSpotPlacementScores.json - // this example is just showing the usage of "ComputeDiagnosticBase_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 SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation - AzureLocation location = new AzureLocation("eastus"); - ComputeDiagnosticBase result = await subscriptionResource.GetSpotPlacementScoreAsync(location); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task PostSpotPlacementScore_ReturnsSpotVMPlacementScoresForGivenConfigurations() - { - // Generated from example definition: 2025-06-05/GenerateSpotPlacementScores.json - // this example is just showing the usage of "ComputeDiagnosticBases_Post" 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 = "00000000-0000-0000-0000-000000000000"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation - AzureLocation location = new AzureLocation("eastus"); - SpotPlacementScoresContent content = new SpotPlacementScoresContent - { - DesiredLocations = { new AzureLocation("eastus"), new AzureLocation("eastus2") }, - DesiredSizes = {new ComputeRecommenderResourceSize -{ -Sku = "Standard_D2_v2", -}}, - DesiredCount = 1, - AvailabilityZones = true, - }; - SpotPlacementScoresResult result = await subscriptionResource.PostSpotPlacementScoreAsync(location, content); - - Console.WriteLine($"Succeeded: {result}"); - } - } -} diff --git a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tsp-location.yaml b/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tsp-location.yaml deleted file mode 100644 index d5bcdf115741..000000000000 --- a/sdk/computerecommender/Azure.ResourceManager.ComputeRecommender/tsp-location.yaml +++ /dev/null @@ -1,4 +0,0 @@ -directory: specification/compute/resource-manager/Microsoft.Compute/RecommenderRP -commit: 3ed4c07ba75ceba9b01d5cf2e4bed0ea988d3c52 -repo: Azure/azure-rest-api-specs -additionalDirectories: diff --git a/sdk/computerecommender/ci.mgmt.yml b/sdk/computerecommender/ci.mgmt.yml index c485cefd8812..d855ed490a68 100644 --- a/sdk/computerecommender/ci.mgmt.yml +++ b/sdk/computerecommender/ci.mgmt.yml @@ -11,16 +11,16 @@ pr: paths: include: - sdk/computerecommender/ci.mgmt.yml - - sdk/computerecommender/Azure.ResourceManager.ComputeRecommender + - sdk/computerecommender/Azure.ResourceManager.Compute.Recommender extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: computerecommender Artifacts: - - name: Azure.ResourceManager.ComputeRecommender + - name: Azure.ResourceManager.Compute.Recommender safeName: AzureResourceManagerComputeRecommender CheckAOTCompat: true AOTTestInputs: - - ArtifactName: Azure.ResourceManager.ComputeRecommender + - ArtifactName: Azure.ResourceManager.Compute.Recommender ExpectedWarningsFilepath: None