diff --git a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.net8.0.cs b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.net8.0.cs index fac44f0490e9..8c70e895b02a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.net8.0.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.net8.0.cs @@ -651,6 +651,44 @@ protected CommunityGalleryResource() { } 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 ComputeDiagnosticBaseCollection : Azure.ResourceManager.ArmCollection + { + protected ComputeDiagnosticBaseCollection() { } + public virtual Azure.Response Exists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ComputeDiagnosticBaseData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeDiagnosticBaseData() { } + public System.Collections.Generic.IList DiagnosticSupportedResourceTypes { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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.ComputeDiagnosticBaseData 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 ComputeDiagnosticBaseResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComputeDiagnosticBaseResource() { } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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 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; } + public virtual Azure.Response Post(Azure.ResourceManager.Compute.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PostAsync(Azure.ResourceManager.Compute.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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.ComputeDiagnosticBaseData 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 ComputeExtensions { public static Azure.ResourceManager.ArmOperation ExportLogAnalyticsRequestRateByInterval(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.RequestRateByIntervalContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -696,6 +734,10 @@ public static partial class ComputeExtensions public static Azure.ResourceManager.Compute.CommunityGalleryImageResource GetCommunityGalleryImageResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Compute.CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Compute.CommunityGalleryResource GetCommunityGalleryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetComputeDiagnosticBase(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> GetComputeDiagnosticBaseAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseCollection GetComputeDiagnosticBases(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetComputeResourceSkus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetComputeResourceSkusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -3115,6 +3157,7 @@ protected MockableComputeArmClient() { } public virtual Azure.ResourceManager.Compute.CommunityGalleryImageResource GetCommunityGalleryImageResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.CommunityGalleryResource GetCommunityGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.DedicatedHostGroupResource GetDedicatedHostGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.DedicatedHostResource GetDedicatedHostResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -3224,6 +3267,9 @@ protected MockableComputeSubscriptionResource() { } public virtual Azure.ResourceManager.Compute.CommunityGalleryCollection GetCommunityGalleries() { throw null; } public virtual Azure.Response GetCommunityGallery(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetCommunityGalleryAsync(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetComputeDiagnosticBase(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetComputeDiagnosticBaseAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseCollection GetComputeDiagnosticBases() { throw null; } public virtual Azure.Pageable GetComputeResourceSkus(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetComputeResourceSkusAsync(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDedicatedHostGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -3461,6 +3507,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.CommunityGalleryMetadata CommunityGalleryMetadata(System.Uri publisherUri = null, string publisherContact = null, string eula = null, System.Collections.Generic.IEnumerable publicNames = null, System.Uri privacyStatementUri = null) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputeApiError ComputeApiError(System.Collections.Generic.IEnumerable details = null, Azure.ResourceManager.Compute.Models.InnerError innererror = null, string code = null, string target = null, string message = null) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputeApiErrorBase ComputeApiErrorBase(string code = null, string target = null, string message = null) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseData ComputeDiagnosticBaseData(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.Compute.Models.ComputeGalleryPlatformAttribute ComputeGalleryPlatformAttribute(string name = null, string value = null) { throw null; } public static Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionData ComputePrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Compute.Models.ComputePrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.Compute.Models.ComputePrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Compute.Models.ComputePrivateEndpointConnectionProvisioningState?)) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputePrivateLinkResourceData ComputePrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } @@ -3561,6 +3608,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.PirCommunityGalleryResourceData PirCommunityGalleryResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string uniqueId = null) { throw null; } public static Azure.ResourceManager.Compute.Models.PirResourceData PirResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?)) { throw null; } public static Azure.ResourceManager.Compute.Models.PirSharedGalleryResourceData PirSharedGalleryResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string uniqueId = null) { throw null; } + public static Azure.ResourceManager.Compute.Models.PlacementScore PlacementScore(string sku = null, string region = null, string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } public static Azure.ResourceManager.Compute.ProximityPlacementGroupData ProximityPlacementGroupData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Compute.Models.ProximityPlacementGroupType? proximityPlacementGroupType = default(Azure.ResourceManager.Compute.Models.ProximityPlacementGroupType?), System.Collections.Generic.IEnumerable virtualMachines = null, System.Collections.Generic.IEnumerable virtualMachineScaleSets = null, System.Collections.Generic.IEnumerable availabilitySets = null, Azure.ResourceManager.Compute.Models.InstanceViewStatus colocationStatus = null, System.Collections.Generic.IEnumerable intentVmSizes = null) { throw null; } public static Azure.ResourceManager.Compute.Models.RecoveryWalkResponse RecoveryWalkResponse(bool? walkPerformed = default(bool?), int? nextPlatformUpdateDomain = default(int?)) { throw null; } public static Azure.ResourceManager.Compute.Models.RegionalReplicationStatus RegionalReplicationStatus(string region = null, Azure.ResourceManager.Compute.Models.RegionalReplicationState? state = default(Azure.ResourceManager.Compute.Models.RegionalReplicationState?), string details = null, int? progress = default(int?)) { throw null; } @@ -3605,6 +3653,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.SharingStatus SharingStatus(Azure.ResourceManager.Compute.Models.SharingState? aggregatedState = default(Azure.ResourceManager.Compute.Models.SharingState?), System.Collections.Generic.IEnumerable summary = null) { throw null; } public static Azure.ResourceManager.Compute.SnapshotData SnapshotData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string managedBy = null, Azure.ResourceManager.Compute.Models.SnapshotSku sku = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null, System.DateTimeOffset? timeCreated = default(System.DateTimeOffset?), Azure.ResourceManager.Compute.Models.SupportedOperatingSystemType? osType = default(Azure.ResourceManager.Compute.Models.SupportedOperatingSystemType?), Azure.ResourceManager.Compute.Models.HyperVGeneration? hyperVGeneration = default(Azure.ResourceManager.Compute.Models.HyperVGeneration?), Azure.ResourceManager.Compute.Models.DiskPurchasePlan purchasePlan = null, Azure.ResourceManager.Compute.Models.SupportedCapabilities supportedCapabilities = null, Azure.ResourceManager.Compute.Models.DiskCreationData creationData = null, int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), Azure.ResourceManager.Compute.Models.DiskState? diskState = default(Azure.ResourceManager.Compute.Models.DiskState?), string uniqueId = null, Azure.ResourceManager.Compute.Models.EncryptionSettingsGroup encryptionSettingsGroup = null, string provisioningState = null, bool? incremental = default(bool?), string incrementalSnapshotFamilyId = null, Azure.ResourceManager.Compute.Models.DiskEncryption encryption = null, Azure.ResourceManager.Compute.Models.NetworkAccessPolicy? networkAccessPolicy = default(Azure.ResourceManager.Compute.Models.NetworkAccessPolicy?), Azure.Core.ResourceIdentifier diskAccessId = null, Azure.ResourceManager.Compute.Models.DiskSecurityProfile securityProfile = null, bool? supportsHibernation = default(bool?), Azure.ResourceManager.Compute.Models.DiskPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Compute.Models.DiskPublicNetworkAccess?), float? completionPercent = default(float?), Azure.ResourceManager.Compute.Models.CopyCompletionError copyCompletionError = null, Azure.ResourceManager.Compute.Models.DataAccessAuthMode? dataAccessAuthMode = default(Azure.ResourceManager.Compute.Models.DataAccessAuthMode?)) { throw null; } public static Azure.ResourceManager.Compute.Models.SnapshotSku SnapshotSku(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType? name = default(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType?), string tier = null) { throw null; } + public static Azure.ResourceManager.Compute.Models.SpotPlacementScoresResponse SpotPlacementScoresResponse(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.SshPublicKeyData SshPublicKeyData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string publicKey = null) { throw null; } public static Azure.ResourceManager.Compute.Models.SshPublicKeyGenerateKeyPairResult SshPublicKeyGenerateKeyPairResult(string privateKey = null, string publicKey = null, Azure.Core.ResourceIdentifier id = null) { throw null; } public static Azure.ResourceManager.Compute.Models.StatusCodeCount StatusCodeCount(string code = null, int? count = default(int?)) { throw null; } @@ -7313,6 +7362,21 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 PlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlacementScore() { } + public string AvailabilityZone { get { throw null; } } + public bool? IsQuotaAvailable { get { throw null; } } + public string 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.Compute.Models.PlacementScore 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.Models.PlacementScore 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; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ProvisionedBandwidthCopyOption : System.IEquatable { @@ -7615,6 +7679,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 ResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ResourceSize() { } + public string Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Models.ResourceSize 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.Models.ResourceSize 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 ResourceSkuCosts : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ResourceSkuCosts() { } @@ -8355,6 +8430,35 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType left, Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType right) { throw null; } public override string ToString() { 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.Compute.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.Compute.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 SpotPlacementScoresResponse : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SpotPlacementScoresResponse() { } + 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.Compute.Models.SpotPlacementScoresResponse 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.Models.SpotPlacementScoresResponse 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 SpotRestorePolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public SpotRestorePolicy() { } diff --git a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs index fac44f0490e9..8c70e895b02a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs @@ -651,6 +651,44 @@ protected CommunityGalleryResource() { } 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 ComputeDiagnosticBaseCollection : Azure.ResourceManager.ArmCollection + { + protected ComputeDiagnosticBaseCollection() { } + public virtual Azure.Response Exists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ComputeDiagnosticBaseData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ComputeDiagnosticBaseData() { } + public System.Collections.Generic.IList DiagnosticSupportedResourceTypes { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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.ComputeDiagnosticBaseData 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 ComputeDiagnosticBaseResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComputeDiagnosticBaseResource() { } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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 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; } + public virtual Azure.Response Post(Azure.ResourceManager.Compute.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PostAsync(Azure.ResourceManager.Compute.Models.SpotPlacementScoresContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Compute.ComputeDiagnosticBaseData 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.ComputeDiagnosticBaseData 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 ComputeExtensions { public static Azure.ResourceManager.ArmOperation ExportLogAnalyticsRequestRateByInterval(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.RequestRateByIntervalContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -696,6 +734,10 @@ public static partial class ComputeExtensions public static Azure.ResourceManager.Compute.CommunityGalleryImageResource GetCommunityGalleryImageResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Compute.CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Compute.CommunityGalleryResource GetCommunityGalleryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetComputeDiagnosticBase(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> GetComputeDiagnosticBaseAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseCollection GetComputeDiagnosticBases(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetComputeResourceSkus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetComputeResourceSkusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -3115,6 +3157,7 @@ protected MockableComputeArmClient() { } public virtual Azure.ResourceManager.Compute.CommunityGalleryImageResource GetCommunityGalleryImageResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.CommunityGalleryResource GetCommunityGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.DedicatedHostGroupResource GetDedicatedHostGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Compute.DedicatedHostResource GetDedicatedHostResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -3224,6 +3267,9 @@ protected MockableComputeSubscriptionResource() { } public virtual Azure.ResourceManager.Compute.CommunityGalleryCollection GetCommunityGalleries() { throw null; } public virtual Azure.Response GetCommunityGallery(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetCommunityGalleryAsync(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetComputeDiagnosticBase(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetComputeDiagnosticBaseAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.ComputeDiagnosticBaseCollection GetComputeDiagnosticBases() { throw null; } public virtual Azure.Pageable GetComputeResourceSkus(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetComputeResourceSkusAsync(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDedicatedHostGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -3461,6 +3507,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.CommunityGalleryMetadata CommunityGalleryMetadata(System.Uri publisherUri = null, string publisherContact = null, string eula = null, System.Collections.Generic.IEnumerable publicNames = null, System.Uri privacyStatementUri = null) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputeApiError ComputeApiError(System.Collections.Generic.IEnumerable details = null, Azure.ResourceManager.Compute.Models.InnerError innererror = null, string code = null, string target = null, string message = null) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputeApiErrorBase ComputeApiErrorBase(string code = null, string target = null, string message = null) { throw null; } + public static Azure.ResourceManager.Compute.ComputeDiagnosticBaseData ComputeDiagnosticBaseData(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.Compute.Models.ComputeGalleryPlatformAttribute ComputeGalleryPlatformAttribute(string name = null, string value = null) { throw null; } public static Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionData ComputePrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Compute.Models.ComputePrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.Compute.Models.ComputePrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Compute.Models.ComputePrivateEndpointConnectionProvisioningState?)) { throw null; } public static Azure.ResourceManager.Compute.Models.ComputePrivateLinkResourceData ComputePrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } @@ -3561,6 +3608,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.PirCommunityGalleryResourceData PirCommunityGalleryResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string uniqueId = null) { throw null; } public static Azure.ResourceManager.Compute.Models.PirResourceData PirResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?)) { throw null; } public static Azure.ResourceManager.Compute.Models.PirSharedGalleryResourceData PirSharedGalleryResourceData(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string uniqueId = null) { throw null; } + public static Azure.ResourceManager.Compute.Models.PlacementScore PlacementScore(string sku = null, string region = null, string availabilityZone = null, string score = null, bool? isQuotaAvailable = default(bool?)) { throw null; } public static Azure.ResourceManager.Compute.ProximityPlacementGroupData ProximityPlacementGroupData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Compute.Models.ProximityPlacementGroupType? proximityPlacementGroupType = default(Azure.ResourceManager.Compute.Models.ProximityPlacementGroupType?), System.Collections.Generic.IEnumerable virtualMachines = null, System.Collections.Generic.IEnumerable virtualMachineScaleSets = null, System.Collections.Generic.IEnumerable availabilitySets = null, Azure.ResourceManager.Compute.Models.InstanceViewStatus colocationStatus = null, System.Collections.Generic.IEnumerable intentVmSizes = null) { throw null; } public static Azure.ResourceManager.Compute.Models.RecoveryWalkResponse RecoveryWalkResponse(bool? walkPerformed = default(bool?), int? nextPlatformUpdateDomain = default(int?)) { throw null; } public static Azure.ResourceManager.Compute.Models.RegionalReplicationStatus RegionalReplicationStatus(string region = null, Azure.ResourceManager.Compute.Models.RegionalReplicationState? state = default(Azure.ResourceManager.Compute.Models.RegionalReplicationState?), string details = null, int? progress = default(int?)) { throw null; } @@ -3605,6 +3653,7 @@ public static partial class ArmComputeModelFactory public static Azure.ResourceManager.Compute.Models.SharingStatus SharingStatus(Azure.ResourceManager.Compute.Models.SharingState? aggregatedState = default(Azure.ResourceManager.Compute.Models.SharingState?), System.Collections.Generic.IEnumerable summary = null) { throw null; } public static Azure.ResourceManager.Compute.SnapshotData SnapshotData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string managedBy = null, Azure.ResourceManager.Compute.Models.SnapshotSku sku = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null, System.DateTimeOffset? timeCreated = default(System.DateTimeOffset?), Azure.ResourceManager.Compute.Models.SupportedOperatingSystemType? osType = default(Azure.ResourceManager.Compute.Models.SupportedOperatingSystemType?), Azure.ResourceManager.Compute.Models.HyperVGeneration? hyperVGeneration = default(Azure.ResourceManager.Compute.Models.HyperVGeneration?), Azure.ResourceManager.Compute.Models.DiskPurchasePlan purchasePlan = null, Azure.ResourceManager.Compute.Models.SupportedCapabilities supportedCapabilities = null, Azure.ResourceManager.Compute.Models.DiskCreationData creationData = null, int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), Azure.ResourceManager.Compute.Models.DiskState? diskState = default(Azure.ResourceManager.Compute.Models.DiskState?), string uniqueId = null, Azure.ResourceManager.Compute.Models.EncryptionSettingsGroup encryptionSettingsGroup = null, string provisioningState = null, bool? incremental = default(bool?), string incrementalSnapshotFamilyId = null, Azure.ResourceManager.Compute.Models.DiskEncryption encryption = null, Azure.ResourceManager.Compute.Models.NetworkAccessPolicy? networkAccessPolicy = default(Azure.ResourceManager.Compute.Models.NetworkAccessPolicy?), Azure.Core.ResourceIdentifier diskAccessId = null, Azure.ResourceManager.Compute.Models.DiskSecurityProfile securityProfile = null, bool? supportsHibernation = default(bool?), Azure.ResourceManager.Compute.Models.DiskPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Compute.Models.DiskPublicNetworkAccess?), float? completionPercent = default(float?), Azure.ResourceManager.Compute.Models.CopyCompletionError copyCompletionError = null, Azure.ResourceManager.Compute.Models.DataAccessAuthMode? dataAccessAuthMode = default(Azure.ResourceManager.Compute.Models.DataAccessAuthMode?)) { throw null; } public static Azure.ResourceManager.Compute.Models.SnapshotSku SnapshotSku(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType? name = default(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType?), string tier = null) { throw null; } + public static Azure.ResourceManager.Compute.Models.SpotPlacementScoresResponse SpotPlacementScoresResponse(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.SshPublicKeyData SshPublicKeyData(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.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string publicKey = null) { throw null; } public static Azure.ResourceManager.Compute.Models.SshPublicKeyGenerateKeyPairResult SshPublicKeyGenerateKeyPairResult(string privateKey = null, string publicKey = null, Azure.Core.ResourceIdentifier id = null) { throw null; } public static Azure.ResourceManager.Compute.Models.StatusCodeCount StatusCodeCount(string code = null, int? count = default(int?)) { throw null; } @@ -7313,6 +7362,21 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 PlacementScore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlacementScore() { } + public string AvailabilityZone { get { throw null; } } + public bool? IsQuotaAvailable { get { throw null; } } + public string 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.Compute.Models.PlacementScore 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.Models.PlacementScore 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; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ProvisionedBandwidthCopyOption : System.IEquatable { @@ -7615,6 +7679,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 ResourceSize : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ResourceSize() { } + public string Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Models.ResourceSize 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.Models.ResourceSize 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 ResourceSkuCosts : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ResourceSkuCosts() { } @@ -8355,6 +8430,35 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType left, Azure.ResourceManager.Compute.Models.SnapshotStorageAccountType right) { throw null; } public override string ToString() { 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.Compute.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.Compute.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 SpotPlacementScoresResponse : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SpotPlacementScoresResponse() { } + 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.Compute.Models.SpotPlacementScoresResponse 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.Models.SpotPlacementScoresResponse 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 SpotRestorePolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public SpotRestorePolicy() { } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs index 7db942270bd3..2086b81f58b8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs @@ -2480,6 +2480,66 @@ public static VirtualMachineRunCommandUpdate VirtualMachineRunCommandUpdate(IDic treatFailureAsDeploymentFailure); } + /// 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 ComputeDiagnosticBaseData ComputeDiagnosticBaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable diagnosticSupportedResourceTypes = null) + { + diagnosticSupportedResourceTypes ??= new List(); + + return new ComputeDiagnosticBaseData( + 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 SpotPlacementScoresResponse SpotPlacementScoresResponse(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 SpotPlacementScoresResponse( + 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 PlacementScore PlacementScore(string sku = null, string region = null, string availabilityZone = null, string score = null, bool? isQuotaAvailable = null) + { + return new PlacementScore( + sku, + region, + availabilityZone, + score, + isQuotaAvailable, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseCollection.cs new file mode 100644 index 000000000000..cf786ba109c4 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseCollection.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Compute +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetComputeDiagnosticBases method from an instance of . + /// + public partial class ComputeDiagnosticBaseCollection : ArmCollection + { + private readonly ClientDiagnostics _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics; + private readonly SpotPlacementScoresRestOperations _computeDiagnosticBaseSpotPlacementScoresRestClient; + + /// Initializes a new instance of the class for mocking. + protected ComputeDiagnosticBaseCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ComputeDiagnosticBaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Compute", ComputeDiagnosticBaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ComputeDiagnosticBaseResource.ResourceType, out string computeDiagnosticBaseSpotPlacementScoresApiVersion); + _computeDiagnosticBaseSpotPlacementScoresRestClient = new SpotPlacementScoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, computeDiagnosticBaseSpotPlacementScoresApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> GetAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.Get"); + scope.Start(); + try + { + var response = await _computeDiagnosticBaseSpotPlacementScoresRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + 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 + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual Response Get(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.Get"); + scope.Start(); + try + { + var response = _computeDiagnosticBaseSpotPlacementScoresRestClient.Get(Id.SubscriptionId, location, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.Exists"); + scope.Start(); + try + { + var response = await _computeDiagnosticBaseSpotPlacementScoresRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual Response Exists(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.Exists"); + scope.Start(); + try + { + var response = _computeDiagnosticBaseSpotPlacementScoresRestClient.Get(Id.SubscriptionId, location, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _computeDiagnosticBaseSpotPlacementScoresRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _computeDiagnosticBaseSpotPlacementScoresRestClient.Get(Id.SubscriptionId, location, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.Serialization.cs new file mode 100644 index 000000000000..b56b82f85fe7 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute +{ + public partial class ComputeDiagnosticBaseData : 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(ComputeDiagnosticBaseData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ComputeDiagnosticBaseData 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(ComputeDiagnosticBaseData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeComputeDiagnosticBaseData(document.RootElement, options); + } + + internal static ComputeDiagnosticBaseData DeserializeComputeDiagnosticBaseData(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 = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ComputeDiagnosticBaseData( + 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, AzureResourceManagerComputeContext.Default); + default: + throw new FormatException($"The model {nameof(ComputeDiagnosticBaseData)} does not support writing '{options.Format}' format."); + } + } + + ComputeDiagnosticBaseData 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 DeserializeComputeDiagnosticBaseData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeDiagnosticBaseData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.cs new file mode 100644 index 000000000000..f4fb2648109e --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseData.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Compute +{ + /// + /// A class representing the ComputeDiagnosticBase data model. + /// Contains metadata of a diagnostic type + /// + public partial class ComputeDiagnosticBaseData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ComputeDiagnosticBaseData() + { + } + + /// 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 ComputeDiagnosticBaseData(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; set; } + /// Describes what are the supported resource types for a diagnostic. + public IList DiagnosticSupportedResourceTypes + { + get + { + if (Properties is null) + Properties = new DiagnosticProperties(); + return Properties.SupportedResourceTypes; + } + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.Serialization.cs new file mode 100644 index 000000000000..82a04b2170f7 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Compute +{ + public partial class ComputeDiagnosticBaseResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ComputeDiagnosticBaseData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerComputeContext.Default); + + ComputeDiagnosticBaseData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerComputeContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.cs new file mode 100644 index 000000000000..c4f5d56320b5 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputeDiagnosticBaseResource.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Compute +{ + /// + /// A Class representing a ComputeDiagnosticBase 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 GetComputeDiagnosticBaseResource method. + /// Otherwise you can get one from its parent resource using the GetComputeDiagnosticBase method. + /// + public partial class ComputeDiagnosticBaseResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics; + private readonly SpotPlacementScoresRestOperations _computeDiagnosticBaseSpotPlacementScoresRestClient; + private readonly ComputeDiagnosticBaseData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Compute/locations/placementScores"; + + /// Initializes a new instance of the class for mocking. + protected ComputeDiagnosticBaseResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ComputeDiagnosticBaseResource(ArmClient client, ComputeDiagnosticBaseData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ComputeDiagnosticBaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Compute", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string computeDiagnosticBaseSpotPlacementScoresApiVersion); + _computeDiagnosticBaseSpotPlacementScoresRestClient = new SpotPlacementScoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, computeDiagnosticBaseSpotPlacementScoresApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ComputeDiagnosticBaseData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseResource.Get"); + scope.Start(); + try + { + var response = await _computeDiagnosticBaseSpotPlacementScoresRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + 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 + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseResource.Get"); + scope.Start(); + try + { + var response = _computeDiagnosticBaseSpotPlacementScoresRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComputeDiagnosticBaseResource(Client, response.Value), response.GetRawResponse()); + } + 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 + /// SpotPlacementScores_Post + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> PostAsync(SpotPlacementScoresContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseResource.Post"); + scope.Start(); + try + { + var response = await _computeDiagnosticBaseSpotPlacementScoresRestClient.PostAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), 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 + /// SpotPlacementScores_Post + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// SpotPlacementScores object supplied in the body of the Post spot placement scores operation. + /// The cancellation token to use. + /// is null. + public virtual Response Post(SpotPlacementScoresContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _computeDiagnosticBaseSpotPlacementScoresClientDiagnostics.CreateScope("ComputeDiagnosticBaseResource.Post"); + scope.Start(); + try + { + var response = _computeDiagnosticBaseSpotPlacementScoresRestClient.Post(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs index 105b20f182c7..afb30f6106bf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs @@ -413,6 +413,25 @@ public static VirtualMachineScaleSetVmRunCommandResource GetVirtualMachineScaleS return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetVmRunCommandResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableComputeArmClient(client).GetComputeDiagnosticBaseResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -2384,6 +2403,97 @@ public static Response GetVirtualMachineEx return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineExtensionImage(location, publisherName, type, version, cancellationToken); } + /// + /// Gets a collection of ComputeDiagnosticBaseResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ComputeDiagnosticBaseResources and their operations over a ComputeDiagnosticBaseResource. + public static ComputeDiagnosticBaseCollection GetComputeDiagnosticBases(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableComputeSubscriptionResource(subscriptionResource).GetComputeDiagnosticBases(); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + [ForwardsClientCalls] + public static async Task> GetComputeDiagnosticBaseAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetComputeDiagnosticBaseAsync(location, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + [ForwardsClientCalls] + public static Response GetComputeDiagnosticBase(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableComputeSubscriptionResource(subscriptionResource).GetComputeDiagnosticBase(location, cancellationToken); + } + /// /// Gets a collection of SharedGalleryResources in the SubscriptionResource. /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs index 488486eb4afb..512d27e1b225 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs @@ -274,6 +274,18 @@ public virtual VirtualMachineScaleSetVmRunCommandResource GetVirtualMachineScale return new VirtualMachineScaleSetVmRunCommandResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComputeDiagnosticBaseResource GetComputeDiagnosticBaseResource(ResourceIdentifier id) + { + ComputeDiagnosticBaseResource.ValidateResourceId(id); + return new ComputeDiagnosticBaseResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs index 759e0bb02262..4b534c5b84ca 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs @@ -205,6 +205,71 @@ public virtual Response GetVirtualMachineE return GetVirtualMachineExtensionImages(location, publisherName).Get(type, version, cancellationToken); } + /// Gets a collection of ComputeDiagnosticBaseResources in the SubscriptionResource. + /// An object representing collection of ComputeDiagnosticBaseResources and their operations over a ComputeDiagnosticBaseResource. + public virtual ComputeDiagnosticBaseCollection GetComputeDiagnosticBases() + { + return GetCachedClient(client => new ComputeDiagnosticBaseCollection(client, Id)); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetComputeDiagnosticBaseAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + return await GetComputeDiagnosticBases().GetAsync(location, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Spot Placement Scores metadata. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/placementScores/spot + /// + /// + /// Operation Id + /// SpotPlacementScores_Get + /// + /// + /// Default Api Version + /// 2025-06-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetComputeDiagnosticBase(AzureLocation location, CancellationToken cancellationToken = default) + { + return GetComputeDiagnosticBases().Get(location, cancellationToken); + } + /// Gets a collection of SharedGalleryResources in the SubscriptionResource. /// Resource location. /// An object representing collection of SharedGalleryResources and their operations over a SharedGalleryResource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.Serialization.cs new file mode 100644 index 000000000000..fe86269d9c0a --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Compute.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; + } + IList 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, AzureResourceManagerComputeContext.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/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.cs new file mode 100644 index 000000000000..d4b099509f21 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.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 . + public 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(IList supportedResourceTypes, IDictionary serializedAdditionalRawData) + { + SupportedResourceTypes = supportedResourceTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Describes what are the supported resource types for a diagnostic. + public IList SupportedResourceTypes { get; } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.Serialization.cs new file mode 100644 index 000000000000..d14465d41e03 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Compute.Models +{ + public partial class PlacementScore : 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(PlacementScore)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(AvailabilityZone)) + { + writer.WritePropertyName("availabilityZone"u8); + writer.WriteStringValue(AvailabilityZone); + } + if (Optional.IsDefined(Score)) + { + writer.WritePropertyName("score"u8); + writer.WriteStringValue(Score); + } + if (Optional.IsDefined(IsQuotaAvailable)) + { + writer.WritePropertyName("isQuotaAvailable"u8); + writer.WriteBooleanValue(IsQuotaAvailable.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 + } + } + } + + PlacementScore 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(PlacementScore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlacementScore(document.RootElement, options); + } + + internal static PlacementScore DeserializePlacementScore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string sku = default; + string region = default; + string availabilityZone = default; + string score = default; + bool? isQuotaAvailable = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("availabilityZone"u8)) + { + availabilityZone = property.Value.GetString(); + continue; + } + if (property.NameEquals("score"u8)) + { + score = property.Value.GetString(); + continue; + } + if (property.NameEquals("isQuotaAvailable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isQuotaAvailable = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlacementScore( + sku, + region, + availabilityZone, + score, + isQuotaAvailable, + 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, AzureResourceManagerComputeContext.Default); + default: + throw new FormatException($"The model {nameof(PlacementScore)} does not support writing '{options.Format}' format."); + } + } + + PlacementScore 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 DeserializePlacementScore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlacementScore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.cs new file mode 100644 index 000000000000..97b40a6fe119 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PlacementScore.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.Models +{ + /// The spot placement score for sku/region/zone combination. + public partial class PlacementScore + { + /// + /// 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 PlacementScore() + { + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal PlacementScore(string sku, string region, string availabilityZone, string score, bool? isQuotaAvailable, IDictionary serializedAdditionalRawData) + { + Sku = sku; + Region = region; + AvailabilityZone = availabilityZone; + Score = score; + IsQuotaAvailable = isQuotaAvailable; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource's CRP virtual machine SKU size. + public string Sku { get; } + /// The region. + public string 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/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.Serialization.cs new file mode 100644 index 000000000000..94057e0e84c9 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Compute.Models +{ + public partial class ResourceSize : 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(ResourceSize)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + 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 + } + } + } + + ResourceSize 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(ResourceSize)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSize(document.RootElement, options); + } + + internal static ResourceSize DeserializeResourceSize(JsonElement element, ModelReaderWriterOptions options = null) + { + 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()) + { + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSize(sku, 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, AzureResourceManagerComputeContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceSize)} does not support writing '{options.Format}' format."); + } + } + + ResourceSize 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 DeserializeResourceSize(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSize)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.cs new file mode 100644 index 000000000000..a202b27cf12d --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSize.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.Models +{ + /// SpotPlacementRecommender API response. + public partial class ResourceSize + { + /// + /// 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 ResourceSize() + { + } + + /// Initializes a new instance of . + /// The resource's CRP virtual machine SKU size. + /// Keeps track of any properties unknown to the library. + internal ResourceSize(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/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs new file mode 100644 index 000000000000..d428c976c402 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.Serialization.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft 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.Compute.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(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(ResourceSize.DeserializeResourceSize(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, AzureResourceManagerComputeContext.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/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.cs new file mode 100644 index 000000000000..49cb8c3a861d --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresContent.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.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/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.Serialization.cs new file mode 100644 index 000000000000..530f385ee42e --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.Serialization.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft 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.Compute.Models +{ + public partial class SpotPlacementScoresResponse : 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(SpotPlacementScoresResponse)} 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 + } + } + } + + SpotPlacementScoresResponse 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(SpotPlacementScoresResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSpotPlacementScoresResponse(document.RootElement, options); + } + + internal static SpotPlacementScoresResponse DeserializeSpotPlacementScoresResponse(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(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(ResourceSize.DeserializeResourceSize(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(PlacementScore.DeserializePlacementScore(item, options)); + } + placementScores = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SpotPlacementScoresResponse( + 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, AzureResourceManagerComputeContext.Default); + default: + throw new FormatException($"The model {nameof(SpotPlacementScoresResponse)} does not support writing '{options.Format}' format."); + } + } + + SpotPlacementScoresResponse 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 DeserializeSpotPlacementScoresResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SpotPlacementScoresResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.cs new file mode 100644 index 000000000000..1754afb82cc2 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotPlacementScoresResponse.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.Models +{ + /// SpotPlacementScores API response. + public partial class SpotPlacementScoresResponse + { + /// + /// 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 SpotPlacementScoresResponse() + { + 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 SpotPlacementScoresResponse(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/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs new file mode 100644 index 000000000000..42e4986a825c --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SpotPlacementScoresRestOperations.cs @@ -0,0 +1,219 @@ +// 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.Compute.Models; + +namespace Azure.ResourceManager.Compute +{ + 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. + /// server parameter. + /// Api Version. + /// 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-01"; + _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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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: + { + ComputeDiagnosticBaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ComputeDiagnosticBaseData.DeserializeComputeDiagnosticBaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComputeDiagnosticBaseData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets Spot Placement Scores metadata. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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: + { + ComputeDiagnosticBaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ComputeDiagnosticBaseData.DeserializeComputeDiagnosticBaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComputeDiagnosticBaseData)null, 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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: + { + SpotPlacementScoresResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SpotPlacementScoresResponse.DeserializeSpotPlacementScoresResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Generates placement scores for Spot VM skus. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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: + { + SpotPlacementScoresResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SpotPlacementScoresResponse.DeserializeSpotPlacementScoresResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md b/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md index 1366fb3e33ff..54352fe6f413 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md +++ b/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md @@ -10,7 +10,7 @@ Run `dotnet build /t:GenerateCode` to generate code. azure-arm: true library-name: Compute namespace: Azure.ResourceManager.Compute -require: https://github.com/Azure/azure-rest-api-specs/blob/883abbe08d313739069c0007eb820aa0a0710748/specification/compute/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.md #tag: package-2025-02-01 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseCollection.cs new file mode 100644 index 000000000000..399004aa7ef9 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseCollection.cs @@ -0,0 +1,119 @@ +// 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.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Compute.Samples +{ + public partial class Sample_ComputeDiagnosticBaseCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsTheMetadataOfSpotPlacementScores() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/stable/2025-06-01/examples/GetSpotPlacementScores.json + // this example is just showing the usage of "SpotPlacementScores_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); + + // get the collection of this ComputeDiagnosticBaseResource + ComputeDiagnosticBaseCollection collection = subscriptionResource.GetComputeDiagnosticBases(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + ComputeDiagnosticBaseResource result = await collection.GetAsync(location); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComputeDiagnosticBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetsTheMetadataOfSpotPlacementScores() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/stable/2025-06-01/examples/GetSpotPlacementScores.json + // this example is just showing the usage of "SpotPlacementScores_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); + + // get the collection of this ComputeDiagnosticBaseResource + ComputeDiagnosticBaseCollection collection = subscriptionResource.GetComputeDiagnosticBases(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + bool result = await collection.ExistsAsync(location); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsTheMetadataOfSpotPlacementScores() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/stable/2025-06-01/examples/GetSpotPlacementScores.json + // this example is just showing the usage of "SpotPlacementScores_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); + + // get the collection of this ComputeDiagnosticBaseResource + ComputeDiagnosticBaseCollection collection = subscriptionResource.GetComputeDiagnosticBases(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + NullableResponse response = await collection.GetIfExistsAsync(location); + ComputeDiagnosticBaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComputeDiagnosticBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseResource.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseResource.cs new file mode 100644 index 000000000000..b7a45df449e8 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Generated/Samples/Sample_ComputeDiagnosticBaseResource.cs @@ -0,0 +1,83 @@ +// 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.Compute.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Compute.Samples +{ + public partial class Sample_ComputeDiagnosticBaseResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsTheMetadataOfSpotPlacementScores() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/stable/2025-06-01/examples/GetSpotPlacementScores.json + // this example is just showing the usage of "SpotPlacementScores_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 ComputeDiagnosticBaseResource created on azure + // for more information of creating ComputeDiagnosticBaseResource, please refer to the document of ComputeDiagnosticBaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("eastus"); + ResourceIdentifier computeDiagnosticBaseResourceId = ComputeDiagnosticBaseResource.CreateResourceIdentifier(subscriptionId, location); + ComputeDiagnosticBaseResource computeDiagnosticBase = client.GetComputeDiagnosticBaseResource(computeDiagnosticBaseResourceId); + + // invoke the operation + ComputeDiagnosticBaseResource result = await computeDiagnosticBase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComputeDiagnosticBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Post_ReturnsSpotVMPlacementScoresForGivenConfigurations() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/stable/2025-06-01/examples/GenerateSpotPlacementScores.json + // this example is just showing the usage of "SpotPlacementScores_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 ComputeDiagnosticBaseResource created on azure + // for more information of creating ComputeDiagnosticBaseResource, please refer to the document of ComputeDiagnosticBaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("eastus"); + ResourceIdentifier computeDiagnosticBaseResourceId = ComputeDiagnosticBaseResource.CreateResourceIdentifier(subscriptionId, location); + ComputeDiagnosticBaseResource computeDiagnosticBase = client.GetComputeDiagnosticBaseResource(computeDiagnosticBaseResourceId); + + // invoke the operation + SpotPlacementScoresContent content = new SpotPlacementScoresContent + { + DesiredLocations = { "eastus", "eastus2" }, + DesiredSizes = {new ResourceSize +{ +Sku = "Standard_D2_v2", +}}, + DesiredCount = 1, + AvailabilityZones = true, + }; + SpotPlacementScoresResponse result = await computeDiagnosticBase.PostAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/