diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.net8.0.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.net8.0.cs index 8f835e67d975..d8dce9c4d766 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.net8.0.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.net8.0.cs @@ -20,30 +20,8 @@ protected DeviceRegistryAssetCollection() { } public partial class DeviceRegistryAssetData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } - public System.Uri AssetEndpointProfileUri { get { throw null; } set { } } - public string AssetType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Attributes { get { throw null; } } - public System.Collections.Generic.IList DataPoints { get { throw null; } } - public string DefaultDataPointsConfiguration { get { throw null; } set { } } - public string DefaultEventsConfiguration { get { throw null; } set { } } - public string Description { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } - public System.Uri DocumentationUri { get { throw null; } set { } } - public bool? Enabled { get { throw null; } set { } } - public System.Collections.Generic.IList Events { get { throw null; } } public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } - public string ExternalAssetId { get { throw null; } set { } } - public string HardwareRevision { get { throw null; } set { } } - public string Manufacturer { get { throw null; } set { } } - public System.Uri ManufacturerUri { get { throw null; } set { } } - public string Model { get { throw null; } set { } } - public string ProductCode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } - public string SerialNumber { get { throw null; } set { } } - public string SoftwareRevision { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.AssetStatus Status { get { throw null; } } - public string Uuid { get { throw null; } } - public int? Version { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData 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) { } @@ -71,13 +49,8 @@ protected DeviceRegistryAssetEndpointProfileCollection() { } public partial class DeviceRegistryAssetEndpointProfileData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetEndpointProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } - public string AdditionalConfiguration { get { throw null; } set { } } public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } - public System.Uri TargetAddress { get { throw null; } set { } } - public System.Collections.Generic.IList TransportAuthenticationOwnCertificates { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication UserAuthentication { get { throw null; } set { } } - public string Uuid { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData 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) { } @@ -135,6 +108,156 @@ protected DeviceRegistryAssetResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class DeviceRegistryBillingContainerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryBillingContainerCollection() { } + public virtual Azure.Response Exists(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryBillingContainerData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryBillingContainerData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? BillingContainerProvisioningState { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData 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.DeviceRegistry.DeviceRegistryBillingContainerData 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 DeviceRegistryBillingContainerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryBillingContainerResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string billingContainerName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData 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.DeviceRegistry.DeviceRegistryBillingContainerData 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 DeviceRegistryDiscoveredAssetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryDiscoveredAssetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string discoveredAssetName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string discoveredAssetName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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 DeviceRegistryDiscoveredAssetEndpointProfileCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryDiscoveredAssetEndpointProfileCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string discoveredAssetEndpointProfileName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string discoveredAssetEndpointProfileName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetEndpointProfileData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetEndpointProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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 DeviceRegistryDiscoveredAssetEndpointProfileResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryDiscoveredAssetEndpointProfileResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryDiscoveredAssetResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public static partial class DeviceRegistryExtensions { public static Azure.Response GetDeviceRegistryAsset(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string assetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -149,6 +272,184 @@ public static partial class DeviceRegistryExtensions public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetCollection GetDeviceRegistryAssets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetDeviceRegistryAssets(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeviceRegistryAssetsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistryBillingContainer(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryBillingContainerAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetDeviceRegistryDiscoveredAsset(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistryDiscoveredAssetEndpointProfile(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistryDiscoveredAssets(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistrySchemaRegistries(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistrySchemaRegistry(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistrySchemaRegistryAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DeviceRegistrySchemaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData 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.DeviceRegistry.DeviceRegistrySchemaData 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 DeviceRegistrySchemaRegistryCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaRegistryCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaRegistryName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaRegistryName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaRegistryData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaRegistryData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData 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.DeviceRegistry.DeviceRegistrySchemaRegistryData 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 DeviceRegistrySchemaRegistryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaRegistryResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistrySchema(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaCollection GetDeviceRegistrySchemas() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData 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.DeviceRegistry.DeviceRegistrySchemaRegistryData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistrySchemaResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistrySchemaVersion(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaVersionAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionCollection GetDeviceRegistrySchemaVersions() { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData 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.DeviceRegistry.DeviceRegistrySchemaData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistrySchemaVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaVersionName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaVersionName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaVersionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaVersionData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData 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.DeviceRegistry.DeviceRegistrySchemaVersionData 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 DeviceRegistrySchemaVersionResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaVersionResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData 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.DeviceRegistry.DeviceRegistrySchemaVersionData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.DeviceRegistry.Mocking @@ -158,6 +459,12 @@ public partial class MockableDeviceRegistryArmClient : Azure.ResourceManager.Arm protected MockableDeviceRegistryArmClient() { } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileResource GetDeviceRegistryAssetEndpointProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetResource GetDeviceRegistryAssetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableDeviceRegistryResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -168,6 +475,15 @@ protected MockableDeviceRegistryResourceGroupResource() { } public virtual System.Threading.Tasks.Task> GetDeviceRegistryAssetEndpointProfileAsync(string assetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAssetEndpointProfiles() { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetCollection GetDeviceRegistryAssets() { throw null; } + public virtual Azure.Response GetDeviceRegistryDiscoveredAsset(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistryDiscoveredAssetEndpointProfile(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles() { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets() { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries() { throw null; } + public virtual Azure.Response GetDeviceRegistrySchemaRegistry(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaRegistryAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MockableDeviceRegistrySubscriptionResource : Azure.ResourceManager.ArmResource { @@ -176,100 +492,175 @@ protected MockableDeviceRegistrySubscriptionResource() { } public virtual Azure.AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDeviceRegistryAssets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDeviceRegistryAssetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistryBillingContainer(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryBillingContainerAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers() { throw null; } + public virtual Azure.Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceRegistryDiscoveredAssets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceRegistrySchemaRegistries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.DeviceRegistry.Models { public static partial class ArmDeviceRegistryModelFactory { - public static Azure.ResourceManager.DeviceRegistry.Models.AssetStatus AssetStatus(System.Collections.Generic.IEnumerable errors = null, int? version = default(int?)) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.AssetStatusError AssetStatusError(int? code = default(int?), string message = null) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData DeviceRegistryAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, string assetType = null, bool? enabled = default(bool?), string externalAssetId = null, string displayName = null, string description = null, System.Uri assetEndpointProfileUri = null, int? version = default(int?), string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, System.Collections.Generic.IDictionary attributes = null, string defaultDataPointsConfiguration = null, string defaultEventsConfiguration = null, System.Collections.Generic.IEnumerable dataPoints = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.AssetStatus status = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, System.Uri targetAddress = null, Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication userAuthentication = null, System.Collections.Generic.IEnumerable transportAuthenticationOwnCertificates = null, string additionalConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileStatusError AssetEndpointProfileStatusError(int? code = default(int?), string message = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AssetProperties AssetProperties(string uuid = null, bool? isEnabled = default(bool?), string externalAssetId = null, string displayName = null, string description = null, string assetEndpointProfileRef = null, long? version = default(long?), string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, System.Collections.Generic.IDictionary attributes = null, System.Collections.Generic.IEnumerable discoveredAssetRefs = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic defaultTopic = null, System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus status = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData DeviceRegistryAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.AssetProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties DeviceRegistryAssetEndpointProfileProperties(string uuid = null, System.Uri targetAddress = null, string endpointProfileType = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication authentication = null, string additionalConfiguration = null, string discoveredAssetEndpointProfileRef = null, System.Collections.Generic.IEnumerable statusErrors = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus DeviceRegistryAssetStatus(System.Collections.Generic.IEnumerable errors = null, long? version = default(long?), System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset DeviceRegistryAssetStatusDataset(string name = null, Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference messageSchemaReference = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusError DeviceRegistryAssetStatusError(int? code = default(int?), string message = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent DeviceRegistryAssetStatusEvent(string name = null, Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference messageSchemaReference = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData DeviceRegistryBillingContainerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? billingContainerProvisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData DeviceRegistryDiscoveredAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData DeviceRegistryDiscoveredAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef = null, string discoveryId = null, long version = (long)0, string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic defaultTopic = null, System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData DeviceRegistrySchemaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties properties = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties DeviceRegistrySchemaProperties(string uuid = null, string displayName = null, string description = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat format = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType schemaType = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?), System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData DeviceRegistrySchemaRegistryData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties DeviceRegistrySchemaRegistryProperties(string uuid = null, string @namespace = null, string displayName = null, string description = null, System.Uri storageAccountContainerUri = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData DeviceRegistrySchemaVersionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties properties = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties DeviceRegistrySchemaVersionProperties(string uuid = null, string description = null, string schemaContent = null, string hash = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties DiscoveredAssetEndpointProfileProperties(System.Uri targetAddress = null, string additionalConfiguration = null, System.Collections.Generic.IEnumerable supportedAuthenticationMethods = null, string endpointProfileType = null, string discoveryId = null, long version = (long)0, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference(string schemaRegistryNamespace = null, string schemaName = null, string schemaVersion = null) { throw null; } } - public partial class AssetEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetEndpointProfileStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AssetEvent(string eventNotifier) { } - public string CapabilityId { get { throw null; } set { } } - public string EventConfiguration { get { throw null; } set { } } - public string EventNotifier { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode? ObservabilityMode { get { throw null; } set { } } + internal AssetEndpointProfileStatusError() { } + public int? Code { get { throw null; } } + public string Message { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetEvent 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.DeviceRegistry.Models.AssetEvent 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileStatusError 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.DeviceRegistry.Models.AssetEndpointProfileStatusError 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 AssetStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetEndpointProfileUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal AssetStatus() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } - public int? Version { get { throw null; } } + public AssetEndpointProfileUpdateProperties() { } + public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication Authentication { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public System.Uri TargetAddress { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetStatus 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.DeviceRegistry.Models.AssetStatus 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties 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.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties 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 AssetStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal AssetStatusError() { } - public int? Code { get { throw null; } } - public string Message { get { throw null; } } + public AssetProperties(string assetEndpointProfileRef) { } + public string AssetEndpointProfileRef { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Attributes { get { throw null; } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public System.Collections.Generic.IList DiscoveredAssetRefs { get { throw null; } } + public string DisplayName { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string ExternalAssetId { get { throw null; } set { } } + public string HardwareRevision { get { throw null; } set { } } + public bool? IsEnabled { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus Status { get { throw null; } } + public string Uuid { get { throw null; } } + public long? Version { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetStatusError 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.DeviceRegistry.Models.AssetStatusError 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetProperties 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.DeviceRegistry.Models.AssetProperties 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 DataPoint : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DataPoint(string dataSource) { } - public string CapabilityId { get { throw null; } set { } } - public string DataPointConfiguration { get { throw null; } set { } } - public string DataSource { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode? ObservabilityMode { get { throw null; } set { } } + public AssetUpdateProperties() { } + public System.Collections.Generic.IDictionary Attributes { get { throw null; } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string HardwareRevision { get { throw null; } set { } } + public bool? IsEnabled { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.DataPoint 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.DeviceRegistry.Models.DataPoint 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetUpdateProperties 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.DeviceRegistry.Models.AssetUpdateProperties 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 DataPointsObservabilityMode : System.IEquatable + public readonly partial struct AuthenticationMethod : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public DataPointsObservabilityMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Counter { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Gauge { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Histogram { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Log { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode None { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode other) { throw null; } + public AuthenticationMethod(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Anonymous { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Certificate { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod UsernamePassword { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod left, Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod left, Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataPointObservabilityMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataPointObservabilityMode(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Counter { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Gauge { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Histogram { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Log { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode right) { throw null; } public override string ToString() { throw null; } } public partial class DeviceRegistryAssetEndpointProfilePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetEndpointProfilePatch() { } - public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public System.Uri TargetAddress { get { throw null; } set { } } - public System.Collections.Generic.IList TransportAuthenticationOwnCertificates { get { throw null; } } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationUpdate UserAuthentication { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfilePatch 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) { } @@ -277,33 +668,212 @@ 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 DeviceRegistryAssetEndpointProfileProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryAssetEndpointProfileProperties(System.Uri targetAddress, string endpointProfileType) { } + public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication Authentication { get { throw null; } set { } } + public string DiscoveredAssetEndpointProfileRef { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatusErrors { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties 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.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties 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 DeviceRegistryAssetPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetPatch() { } - public string AssetType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Attributes { get { throw null; } } - public System.Collections.Generic.IList DataPoints { get { throw null; } } - public string DefaultDataPointsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch 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.DeviceRegistry.Models.DeviceRegistryAssetPatch 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 DeviceRegistryAssetStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatus() { } + public System.Collections.Generic.IReadOnlyList Datasets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Events { get { throw null; } } + public long? Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus 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.DeviceRegistry.Models.DeviceRegistryAssetStatus 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 DeviceRegistryAssetStatusDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusDataset() { } + public Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset 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.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset 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 DeviceRegistryAssetStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusError() { } + public int? Code { get { throw null; } } + public string Message { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusError 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.DeviceRegistry.Models.DeviceRegistryAssetStatusError 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 DeviceRegistryAssetStatusEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusEvent() { } + public Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent 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.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent 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 DeviceRegistryAuthentication : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryAuthentication(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod method) { } + public Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Method { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials UsernamePasswordCredentials { get { throw null; } set { } } + public string X509CredentialsCertificateSecretName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication 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.DeviceRegistry.Models.DeviceRegistryAuthentication 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 DeviceRegistryDataPoint : Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPointBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataPoint(string name, string dataSource) : base (default(string), default(string)) { } + public Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode? ObservabilityMode { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPoint 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.DeviceRegistry.Models.DeviceRegistryDataPoint 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 DeviceRegistryDataPointBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataPointBase(string name, string dataSource) { } + public string DataPointConfiguration { get { throw null; } set { } } + public string DataSource { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPointBase 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.DeviceRegistry.Models.DeviceRegistryDataPointBase 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 DeviceRegistryDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataset(string name) { } + public System.Collections.Generic.IList DataPoints { get { throw null; } } + public string DatasetConfiguration { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataset 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.DeviceRegistry.Models.DeviceRegistryDataset 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 DeviceRegistryDiscoveredAssetEndpointProfilePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetEndpointProfilePatch() { } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch 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 DeviceRegistryDiscoveredAssetPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetPatch() { } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch 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 DeviceRegistryDiscoveredAssetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef, string discoveryId, long version) { } + public string AssetEndpointProfileRef { get { throw null; } set { } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } public string DefaultEventsConfiguration { get { throw null; } set { } } - public string Description { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } public System.Uri DocumentationUri { get { throw null; } set { } } - public bool? Enabled { get { throw null; } set { } } - public System.Collections.Generic.IList Events { get { throw null; } } + public System.Collections.Generic.IList Events { get { throw null; } } public string HardwareRevision { get { throw null; } set { } } public string Manufacturer { get { throw null; } set { } } public System.Uri ManufacturerUri { get { throw null; } set { } } public string Model { get { throw null; } set { } } public string ProductCode { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } public string SerialNumber { get { throw null; } set { } } public string SoftwareRevision { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public long Version { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch 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.DeviceRegistry.Models.DeviceRegistryAssetPatch 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties 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 DeviceRegistryEvent : Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEventBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryEvent(string name, string eventNotifier) : base (default(string), default(string)) { } + public Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode? ObservabilityMode { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEvent 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.DeviceRegistry.Models.DeviceRegistryEvent 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 DeviceRegistryEventBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryEventBase(string name, string eventNotifier) { } + public string EventConfiguration { get { throw null; } set { } } + public string EventNotifier { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEventBase 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.DeviceRegistry.Models.DeviceRegistryEventBase 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 DeviceRegistryExtendedLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -325,6 +895,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public DeviceRegistryProvisioningState(string value) { throw null; } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Accepted { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Deleting { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Failed { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Succeeded { get { throw null; } } public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState other) { throw null; } @@ -338,103 +909,285 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct EventsObservabilityMode : System.IEquatable + public readonly partial struct DeviceRegistrySchemaFormat : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public EventsObservabilityMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode Log { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode None { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode other) { throw null; } + public DeviceRegistrySchemaFormat(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat Delta10 { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat JsonSchemaDraft7 { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat right) { throw null; } public override string ToString() { throw null; } } - public partial class OwnCertificate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public OwnCertificate() { } - public string CertPasswordReference { get { throw null; } set { } } - public string CertSecretReference { get { throw null; } set { } } - public string CertThumbprint { get { throw null; } set { } } + public DeviceRegistrySchemaProperties(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat format, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType schemaType) { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat Format { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType SchemaType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public string Uuid { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.OwnCertificate 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.DeviceRegistry.Models.OwnCertificate 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaProperties 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 UserAuthentication : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaRegistryPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UserAuthentication(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode mode) { } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Mode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentials UsernamePasswordCredentials { get { throw null; } set { } } - public string X509CredentialsCertificateReference { get { throw null; } set { } } + public DeviceRegistrySchemaRegistryPatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.SchemaRegistryUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication 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.DeviceRegistry.Models.UserAuthentication 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch 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.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch 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 DeviceRegistrySchemaRegistryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaRegistryProperties(string @namespace, System.Uri storageAccountContainerUri) { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Namespace { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Uri StorageAccountContainerUri { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties 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 UserAuthenticationMode : System.IEquatable + public readonly partial struct DeviceRegistrySchemaType : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public UserAuthenticationMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Anonymous { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Certificate { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode UsernamePassword { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode other) { throw null; } + public DeviceRegistrySchemaType(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType MessageSchema { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode left, Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode left, Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType right) { throw null; } public override string ToString() { throw null; } } - public partial class UserAuthenticationUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaVersionProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaVersionProperties(string schemaContent) { } + public string Description { get { throw null; } set { } } + public string Hash { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public string SchemaContent { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties 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 DeviceRegistryTopic : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryTopic(string path) { } + public string Path { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType? Retain { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic 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.DeviceRegistry.Models.DeviceRegistryTopic 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 DeviceRegistryTopicRetainType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeviceRegistryTopicRetainType(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType Keep { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType Never { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DeviceRegistryUsernamePasswordCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryUsernamePasswordCredentials(string usernameSecretName, string passwordSecretName) { } + public string PasswordSecretName { get { throw null; } set { } } + public string UsernameSecretName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials 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.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials 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 DiscoveredAssetEndpointProfileProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredAssetEndpointProfileProperties(System.Uri targetAddress, string endpointProfileType, string discoveryId, long version) { } + public string AdditionalConfiguration { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList SupportedAuthenticationMethods { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public long Version { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties 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.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties 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 DiscoveredAssetEndpointProfileUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredAssetEndpointProfileUpdateProperties() { } + public string AdditionalConfiguration { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public System.Collections.Generic.IList SupportedAuthenticationMethods { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public long? Version { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties 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.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties 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 DiscoveredAssetUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UserAuthenticationUpdate() { } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode? Mode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate UsernamePasswordCredentials { get { throw null; } set { } } - public string X509CredentialsCertificateReference { get { throw null; } set { } } + public DiscoveredAssetUpdateProperties() { } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string HardwareRevision { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } + public long? Version { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationUpdate 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.DeviceRegistry.Models.UserAuthenticationUpdate 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; } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetUpdateProperties 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.DeviceRegistry.Models.DiscoveredAssetUpdateProperties 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 UsernamePasswordCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DiscoveredDataPoint : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UsernamePasswordCredentials(string usernameReference, string passwordReference) { } - public string PasswordReference { get { throw null; } set { } } - public string UsernameReference { get { throw null; } set { } } + public DiscoveredDataPoint(string name, string dataSource) { } + public string DataPointConfiguration { get { throw null; } set { } } + public string DataSource { get { throw null; } set { } } + public System.DateTimeOffset? LastUpdatedOn { get { throw null; } set { } } + public string Name { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentials 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.DeviceRegistry.Models.UsernamePasswordCredentials 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; } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredDataPoint 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.DeviceRegistry.Models.DiscoveredDataPoint 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 UsernamePasswordCredentialsUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DiscoveredDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UsernamePasswordCredentialsUpdate() { } - public string PasswordReference { get { throw null; } set { } } - public string UsernameReference { get { throw null; } set { } } + public DiscoveredDataset(string name) { } + public System.Collections.Generic.IList DataPoints { get { throw null; } } + public string DatasetConfiguration { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredDataset 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.DeviceRegistry.Models.DiscoveredDataset 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 DiscoveredEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredEvent(string name, string eventNotifier) { } + public string EventConfiguration { get { throw null; } set { } } + public string EventNotifier { get { throw null; } set { } } + public System.DateTimeOffset? LastUpdatedOn { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredEvent 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.DeviceRegistry.Models.DiscoveredEvent 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 EventObservabilityMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventObservabilityMode(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode Log { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MessageSchemaReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MessageSchemaReference() { } + public string SchemaName { get { throw null; } } + public string SchemaRegistryNamespace { get { throw null; } } + public string SchemaVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference 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.DeviceRegistry.Models.MessageSchemaReference 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 SchemaRegistryUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchemaRegistryUpdateProperties() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate 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.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate 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; } + Azure.ResourceManager.DeviceRegistry.Models.SchemaRegistryUpdateProperties 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.DeviceRegistry.Models.SchemaRegistryUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.netstandard2.0.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.netstandard2.0.cs index 8f835e67d975..d8dce9c4d766 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.netstandard2.0.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/api/Azure.ResourceManager.DeviceRegistry.netstandard2.0.cs @@ -20,30 +20,8 @@ protected DeviceRegistryAssetCollection() { } public partial class DeviceRegistryAssetData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } - public System.Uri AssetEndpointProfileUri { get { throw null; } set { } } - public string AssetType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Attributes { get { throw null; } } - public System.Collections.Generic.IList DataPoints { get { throw null; } } - public string DefaultDataPointsConfiguration { get { throw null; } set { } } - public string DefaultEventsConfiguration { get { throw null; } set { } } - public string Description { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } - public System.Uri DocumentationUri { get { throw null; } set { } } - public bool? Enabled { get { throw null; } set { } } - public System.Collections.Generic.IList Events { get { throw null; } } public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } - public string ExternalAssetId { get { throw null; } set { } } - public string HardwareRevision { get { throw null; } set { } } - public string Manufacturer { get { throw null; } set { } } - public System.Uri ManufacturerUri { get { throw null; } set { } } - public string Model { get { throw null; } set { } } - public string ProductCode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } - public string SerialNumber { get { throw null; } set { } } - public string SoftwareRevision { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.AssetStatus Status { get { throw null; } } - public string Uuid { get { throw null; } } - public int? Version { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData 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) { } @@ -71,13 +49,8 @@ protected DeviceRegistryAssetEndpointProfileCollection() { } public partial class DeviceRegistryAssetEndpointProfileData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetEndpointProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } - public string AdditionalConfiguration { get { throw null; } set { } } public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } - public System.Uri TargetAddress { get { throw null; } set { } } - public System.Collections.Generic.IList TransportAuthenticationOwnCertificates { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication UserAuthentication { get { throw null; } set { } } - public string Uuid { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData 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) { } @@ -135,6 +108,156 @@ protected DeviceRegistryAssetResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class DeviceRegistryBillingContainerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryBillingContainerCollection() { } + public virtual Azure.Response Exists(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryBillingContainerData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryBillingContainerData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? BillingContainerProvisioningState { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData 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.DeviceRegistry.DeviceRegistryBillingContainerData 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 DeviceRegistryBillingContainerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryBillingContainerResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string billingContainerName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData 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.DeviceRegistry.DeviceRegistryBillingContainerData 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 DeviceRegistryDiscoveredAssetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryDiscoveredAssetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string discoveredAssetName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string discoveredAssetName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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 DeviceRegistryDiscoveredAssetEndpointProfileCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistryDiscoveredAssetEndpointProfileCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string discoveredAssetEndpointProfileName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string discoveredAssetEndpointProfileName, Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetEndpointProfileData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetEndpointProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation) { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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 DeviceRegistryDiscoveredAssetEndpointProfileResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryDiscoveredAssetEndpointProfileResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistryDiscoveredAssetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistryDiscoveredAssetResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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.DeviceRegistry.DeviceRegistryDiscoveredAssetData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public static partial class DeviceRegistryExtensions { public static Azure.Response GetDeviceRegistryAsset(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string assetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -149,6 +272,184 @@ public static partial class DeviceRegistryExtensions public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetCollection GetDeviceRegistryAssets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetDeviceRegistryAssets(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeviceRegistryAssetsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistryBillingContainer(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryBillingContainerAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetDeviceRegistryDiscoveredAsset(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistryDiscoveredAssetEndpointProfile(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistryDiscoveredAssets(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDeviceRegistrySchemaRegistries(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDeviceRegistrySchemaRegistry(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDeviceRegistrySchemaRegistryAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DeviceRegistrySchemaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData 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.DeviceRegistry.DeviceRegistrySchemaData 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 DeviceRegistrySchemaRegistryCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaRegistryCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaRegistryName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaRegistryName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaRegistryData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaRegistryData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData 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.DeviceRegistry.DeviceRegistrySchemaRegistryData 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 DeviceRegistrySchemaRegistryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaRegistryResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistrySchema(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaAsync(string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaCollection GetDeviceRegistrySchemas() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData 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.DeviceRegistry.DeviceRegistrySchemaRegistryData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistrySchemaResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistrySchemaVersion(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaVersionAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionCollection GetDeviceRegistrySchemaVersions() { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData 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.DeviceRegistry.DeviceRegistrySchemaData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DeviceRegistrySchemaVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DeviceRegistrySchemaVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schemaVersionName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schemaVersionName, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schemaVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DeviceRegistrySchemaVersionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaVersionData() { } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData 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.DeviceRegistry.DeviceRegistrySchemaVersionData 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 DeviceRegistrySchemaVersionResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DeviceRegistrySchemaVersionResource() { } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData 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.DeviceRegistry.DeviceRegistrySchemaVersionData 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 virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.DeviceRegistry.Mocking @@ -158,6 +459,12 @@ public partial class MockableDeviceRegistryArmClient : Azure.ResourceManager.Arm protected MockableDeviceRegistryArmClient() { } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileResource GetDeviceRegistryAssetEndpointProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetResource GetDeviceRegistryAssetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableDeviceRegistryResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -168,6 +475,15 @@ protected MockableDeviceRegistryResourceGroupResource() { } public virtual System.Threading.Tasks.Task> GetDeviceRegistryAssetEndpointProfileAsync(string assetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAssetEndpointProfiles() { throw null; } public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetCollection GetDeviceRegistryAssets() { throw null; } + public virtual Azure.Response GetDeviceRegistryDiscoveredAsset(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetAsync(string discoveredAssetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistryDiscoveredAssetEndpointProfile(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(string discoveredAssetEndpointProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles() { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets() { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries() { throw null; } + public virtual Azure.Response GetDeviceRegistrySchemaRegistry(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistrySchemaRegistryAsync(string schemaRegistryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MockableDeviceRegistrySubscriptionResource : Azure.ResourceManager.ArmResource { @@ -176,100 +492,175 @@ protected MockableDeviceRegistrySubscriptionResource() { } public virtual Azure.AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDeviceRegistryAssets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDeviceRegistryAssetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeviceRegistryBillingContainer(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceRegistryBillingContainerAsync(string billingContainerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers() { throw null; } + public virtual Azure.Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceRegistryDiscoveredAssets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceRegistrySchemaRegistries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.DeviceRegistry.Models { public static partial class ArmDeviceRegistryModelFactory { - public static Azure.ResourceManager.DeviceRegistry.Models.AssetStatus AssetStatus(System.Collections.Generic.IEnumerable errors = null, int? version = default(int?)) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.AssetStatusError AssetStatusError(int? code = default(int?), string message = null) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData DeviceRegistryAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, string assetType = null, bool? enabled = default(bool?), string externalAssetId = null, string displayName = null, string description = null, System.Uri assetEndpointProfileUri = null, int? version = default(int?), string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, System.Collections.Generic.IDictionary attributes = null, string defaultDataPointsConfiguration = null, string defaultEventsConfiguration = null, System.Collections.Generic.IEnumerable dataPoints = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.AssetStatus status = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, System.Uri targetAddress = null, Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication userAuthentication = null, System.Collections.Generic.IEnumerable transportAuthenticationOwnCertificates = null, string additionalConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileStatusError AssetEndpointProfileStatusError(int? code = default(int?), string message = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AssetProperties AssetProperties(string uuid = null, bool? isEnabled = default(bool?), string externalAssetId = null, string displayName = null, string description = null, string assetEndpointProfileRef = null, long? version = default(long?), string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, System.Collections.Generic.IDictionary attributes = null, System.Collections.Generic.IEnumerable discoveredAssetRefs = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic defaultTopic = null, System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus status = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetData DeviceRegistryAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.AssetProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties DeviceRegistryAssetEndpointProfileProperties(string uuid = null, System.Uri targetAddress = null, string endpointProfileType = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication authentication = null, string additionalConfiguration = null, string discoveredAssetEndpointProfileRef = null, System.Collections.Generic.IEnumerable statusErrors = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus DeviceRegistryAssetStatus(System.Collections.Generic.IEnumerable errors = null, long? version = default(long?), System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset DeviceRegistryAssetStatusDataset(string name = null, Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference messageSchemaReference = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusError DeviceRegistryAssetStatusError(int? code = default(int?), string message = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent DeviceRegistryAssetStatusEvent(string name = null, Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference messageSchemaReference = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryBillingContainerData DeviceRegistryBillingContainerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? billingContainerProvisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetData DeviceRegistryDiscoveredAssetData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistryDiscoveredAssetEndpointProfileData DeviceRegistryDiscoveredAssetEndpointProfileData(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), Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties properties = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef = null, string discoveryId = null, long version = (long)0, string manufacturer = null, System.Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, System.Uri documentationUri = null, string serialNumber = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic defaultTopic = null, System.Collections.Generic.IEnumerable datasets = null, System.Collections.Generic.IEnumerable events = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaData DeviceRegistrySchemaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties properties = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties DeviceRegistrySchemaProperties(string uuid = null, string displayName = null, string description = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat format = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType schemaType = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?), System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaRegistryData DeviceRegistrySchemaRegistryData(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), Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties DeviceRegistrySchemaRegistryProperties(string uuid = null, string @namespace = null, string displayName = null, string description = null, System.Uri storageAccountContainerUri = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.DeviceRegistrySchemaVersionData DeviceRegistrySchemaVersionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties properties = null) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties DeviceRegistrySchemaVersionProperties(string uuid = null, string description = null, string schemaContent = null, string hash = null, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties DiscoveredAssetEndpointProfileProperties(System.Uri targetAddress = null, string additionalConfiguration = null, System.Collections.Generic.IEnumerable supportedAuthenticationMethods = null, string endpointProfileType = null, string discoveryId = null, long version = (long)0, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? provisioningState = default(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference(string schemaRegistryNamespace = null, string schemaName = null, string schemaVersion = null) { throw null; } } - public partial class AssetEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetEndpointProfileStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AssetEvent(string eventNotifier) { } - public string CapabilityId { get { throw null; } set { } } - public string EventConfiguration { get { throw null; } set { } } - public string EventNotifier { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode? ObservabilityMode { get { throw null; } set { } } + internal AssetEndpointProfileStatusError() { } + public int? Code { get { throw null; } } + public string Message { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetEvent 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.DeviceRegistry.Models.AssetEvent 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileStatusError 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.DeviceRegistry.Models.AssetEndpointProfileStatusError 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 AssetStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetEndpointProfileUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal AssetStatus() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } - public int? Version { get { throw null; } } + public AssetEndpointProfileUpdateProperties() { } + public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication Authentication { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public System.Uri TargetAddress { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetStatus 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.DeviceRegistry.Models.AssetStatus 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties 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.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties 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 AssetStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - internal AssetStatusError() { } - public int? Code { get { throw null; } } - public string Message { get { throw null; } } + public AssetProperties(string assetEndpointProfileRef) { } + public string AssetEndpointProfileRef { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Attributes { get { throw null; } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public System.Collections.Generic.IList DiscoveredAssetRefs { get { throw null; } } + public string DisplayName { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string ExternalAssetId { get { throw null; } set { } } + public string HardwareRevision { get { throw null; } set { } } + public bool? IsEnabled { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus Status { get { throw null; } } + public string Uuid { get { throw null; } } + public long? Version { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.AssetStatusError 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.DeviceRegistry.Models.AssetStatusError 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetProperties 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.DeviceRegistry.Models.AssetProperties 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 DataPoint : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class AssetUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DataPoint(string dataSource) { } - public string CapabilityId { get { throw null; } set { } } - public string DataPointConfiguration { get { throw null; } set { } } - public string DataSource { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode? ObservabilityMode { get { throw null; } set { } } + public AssetUpdateProperties() { } + public System.Collections.Generic.IDictionary Attributes { get { throw null; } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string HardwareRevision { get { throw null; } set { } } + public bool? IsEnabled { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.DataPoint 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.DeviceRegistry.Models.DataPoint 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; } + Azure.ResourceManager.DeviceRegistry.Models.AssetUpdateProperties 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.DeviceRegistry.Models.AssetUpdateProperties 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 DataPointsObservabilityMode : System.IEquatable + public readonly partial struct AuthenticationMethod : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public DataPointsObservabilityMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Counter { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Gauge { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Histogram { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode Log { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode None { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode other) { throw null; } + public AuthenticationMethod(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Anonymous { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Certificate { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod UsernamePassword { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointsObservabilityMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod left, Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod left, Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataPointObservabilityMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataPointObservabilityMode(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Counter { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Gauge { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Histogram { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode Log { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode right) { throw null; } public override string ToString() { throw null; } } public partial class DeviceRegistryAssetEndpointProfilePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetEndpointProfilePatch() { } - public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetEndpointProfileUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public System.Uri TargetAddress { get { throw null; } set { } } - public System.Collections.Generic.IList TransportAuthenticationOwnCertificates { get { throw null; } } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationUpdate UserAuthentication { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfilePatch 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) { } @@ -277,33 +668,212 @@ 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 DeviceRegistryAssetEndpointProfileProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryAssetEndpointProfileProperties(System.Uri targetAddress, string endpointProfileType) { } + public string AdditionalConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication Authentication { get { throw null; } set { } } + public string DiscoveredAssetEndpointProfileRef { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatusErrors { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties 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.DeviceRegistry.Models.DeviceRegistryAssetEndpointProfileProperties 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 DeviceRegistryAssetPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DeviceRegistryAssetPatch() { } - public string AssetType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Attributes { get { throw null; } } - public System.Collections.Generic.IList DataPoints { get { throw null; } } - public string DefaultDataPointsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.AssetUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch 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.DeviceRegistry.Models.DeviceRegistryAssetPatch 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 DeviceRegistryAssetStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatus() { } + public System.Collections.Generic.IReadOnlyList Datasets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Events { get { throw null; } } + public long? Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatus 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.DeviceRegistry.Models.DeviceRegistryAssetStatus 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 DeviceRegistryAssetStatusDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusDataset() { } + public Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset 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.DeviceRegistry.Models.DeviceRegistryAssetStatusDataset 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 DeviceRegistryAssetStatusError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusError() { } + public int? Code { get { throw null; } } + public string Message { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusError 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.DeviceRegistry.Models.DeviceRegistryAssetStatusError 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 DeviceRegistryAssetStatusEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeviceRegistryAssetStatusEvent() { } + public Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference MessageSchemaReference { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent 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.DeviceRegistry.Models.DeviceRegistryAssetStatusEvent 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 DeviceRegistryAuthentication : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryAuthentication(Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod method) { } + public Azure.ResourceManager.DeviceRegistry.Models.AuthenticationMethod Method { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials UsernamePasswordCredentials { get { throw null; } set { } } + public string X509CredentialsCertificateSecretName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAuthentication 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.DeviceRegistry.Models.DeviceRegistryAuthentication 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 DeviceRegistryDataPoint : Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPointBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataPoint(string name, string dataSource) : base (default(string), default(string)) { } + public Azure.ResourceManager.DeviceRegistry.Models.DataPointObservabilityMode? ObservabilityMode { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPoint 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.DeviceRegistry.Models.DeviceRegistryDataPoint 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 DeviceRegistryDataPointBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataPointBase(string name, string dataSource) { } + public string DataPointConfiguration { get { throw null; } set { } } + public string DataSource { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataPointBase 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.DeviceRegistry.Models.DeviceRegistryDataPointBase 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 DeviceRegistryDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDataset(string name) { } + public System.Collections.Generic.IList DataPoints { get { throw null; } } + public string DatasetConfiguration { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDataset 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.DeviceRegistry.Models.DeviceRegistryDataset 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 DeviceRegistryDiscoveredAssetEndpointProfilePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetEndpointProfilePatch() { } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetEndpointProfilePatch 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 DeviceRegistryDiscoveredAssetPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetPatch() { } + public Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetPatch 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 DeviceRegistryDiscoveredAssetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef, string discoveryId, long version) { } + public string AssetEndpointProfileRef { get { throw null; } set { } } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } public string DefaultEventsConfiguration { get { throw null; } set { } } - public string Description { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } public System.Uri DocumentationUri { get { throw null; } set { } } - public bool? Enabled { get { throw null; } set { } } - public System.Collections.Generic.IList Events { get { throw null; } } + public System.Collections.Generic.IList Events { get { throw null; } } public string HardwareRevision { get { throw null; } set { } } public string Manufacturer { get { throw null; } set { } } public System.Uri ManufacturerUri { get { throw null; } set { } } public string Model { get { throw null; } set { } } public string ProductCode { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } public string SerialNumber { get { throw null; } set { } } public string SoftwareRevision { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public long Version { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryAssetPatch 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.DeviceRegistry.Models.DeviceRegistryAssetPatch 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties 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.DeviceRegistry.Models.DeviceRegistryDiscoveredAssetProperties 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 DeviceRegistryEvent : Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEventBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryEvent(string name, string eventNotifier) : base (default(string), default(string)) { } + public Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode? ObservabilityMode { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEvent 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.DeviceRegistry.Models.DeviceRegistryEvent 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 DeviceRegistryEventBase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryEventBase(string name, string eventNotifier) { } + public string EventConfiguration { get { throw null; } set { } } + public string EventNotifier { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryEventBase 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.DeviceRegistry.Models.DeviceRegistryEventBase 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 DeviceRegistryExtendedLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -325,6 +895,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public DeviceRegistryProvisioningState(string value) { throw null; } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Accepted { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Deleting { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Failed { get { throw null; } } public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState Succeeded { get { throw null; } } public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState other) { throw null; } @@ -338,103 +909,285 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct EventsObservabilityMode : System.IEquatable + public readonly partial struct DeviceRegistrySchemaFormat : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public EventsObservabilityMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode Log { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode None { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode other) { throw null; } + public DeviceRegistrySchemaFormat(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat Delta10 { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat JsonSchemaDraft7 { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventsObservabilityMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat right) { throw null; } public override string ToString() { throw null; } } - public partial class OwnCertificate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public OwnCertificate() { } - public string CertPasswordReference { get { throw null; } set { } } - public string CertSecretReference { get { throw null; } set { } } - public string CertThumbprint { get { throw null; } set { } } + public DeviceRegistrySchemaProperties(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat format, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType schemaType) { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaFormat Format { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType SchemaType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public string Uuid { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.OwnCertificate 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.DeviceRegistry.Models.OwnCertificate 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaProperties 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 UserAuthentication : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaRegistryPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UserAuthentication(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode mode) { } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Mode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentials UsernamePasswordCredentials { get { throw null; } set { } } - public string X509CredentialsCertificateReference { get { throw null; } set { } } + public DeviceRegistrySchemaRegistryPatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.SchemaRegistryUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UserAuthentication 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.DeviceRegistry.Models.UserAuthentication 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; } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch 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.DeviceRegistry.Models.DeviceRegistrySchemaRegistryPatch 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 DeviceRegistrySchemaRegistryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaRegistryProperties(string @namespace, System.Uri storageAccountContainerUri) { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Namespace { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Uri StorageAccountContainerUri { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaRegistryProperties 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 UserAuthenticationMode : System.IEquatable + public readonly partial struct DeviceRegistrySchemaType : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public UserAuthenticationMode(string value) { throw null; } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Anonymous { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode Certificate { get { throw null; } } - public static Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode UsernamePassword { get { throw null; } } - public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode other) { throw null; } + public DeviceRegistrySchemaType(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType MessageSchema { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode left, Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode right) { throw null; } - public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode left, Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode right) { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaType right) { throw null; } public override string ToString() { throw null; } } - public partial class UserAuthenticationUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DeviceRegistrySchemaVersionProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistrySchemaVersionProperties(string schemaContent) { } + public string Description { get { throw null; } set { } } + public string Hash { get { throw null; } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public string SchemaContent { get { throw null; } set { } } + public string Uuid { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties 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.DeviceRegistry.Models.DeviceRegistrySchemaVersionProperties 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 DeviceRegistryTopic : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryTopic(string path) { } + public string Path { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType? Retain { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic 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.DeviceRegistry.Models.DeviceRegistryTopic 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 DeviceRegistryTopicRetainType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeviceRegistryTopicRetainType(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType Keep { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType Never { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType left, Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopicRetainType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DeviceRegistryUsernamePasswordCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeviceRegistryUsernamePasswordCredentials(string usernameSecretName, string passwordSecretName) { } + public string PasswordSecretName { get { throw null; } set { } } + public string UsernameSecretName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials 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.DeviceRegistry.Models.DeviceRegistryUsernamePasswordCredentials 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 DiscoveredAssetEndpointProfileProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredAssetEndpointProfileProperties(System.Uri targetAddress, string endpointProfileType, string discoveryId, long version) { } + public string AdditionalConfiguration { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList SupportedAuthenticationMethods { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public long Version { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties 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.DeviceRegistry.Models.DiscoveredAssetEndpointProfileProperties 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 DiscoveredAssetEndpointProfileUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredAssetEndpointProfileUpdateProperties() { } + public string AdditionalConfiguration { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public string EndpointProfileType { get { throw null; } set { } } + public System.Collections.Generic.IList SupportedAuthenticationMethods { get { throw null; } } + public System.Uri TargetAddress { get { throw null; } set { } } + public long? Version { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties 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.DeviceRegistry.Models.DiscoveredAssetEndpointProfileUpdateProperties 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 DiscoveredAssetUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UserAuthenticationUpdate() { } - public Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationMode? Mode { get { throw null; } set { } } - public Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate UsernamePasswordCredentials { get { throw null; } set { } } - public string X509CredentialsCertificateReference { get { throw null; } set { } } + public DiscoveredAssetUpdateProperties() { } + public System.Collections.Generic.IList Datasets { get { throw null; } } + public string DefaultDatasetsConfiguration { get { throw null; } set { } } + public string DefaultEventsConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic DefaultTopic { get { throw null; } set { } } + public string DiscoveryId { get { throw null; } set { } } + public System.Uri DocumentationUri { get { throw null; } set { } } + public System.Collections.Generic.IList Events { get { throw null; } } + public string HardwareRevision { get { throw null; } set { } } + public string Manufacturer { get { throw null; } set { } } + public System.Uri ManufacturerUri { get { throw null; } set { } } + public string Model { get { throw null; } set { } } + public string ProductCode { get { throw null; } set { } } + public string SerialNumber { get { throw null; } set { } } + public string SoftwareRevision { get { throw null; } set { } } + public long? Version { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UserAuthenticationUpdate 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.DeviceRegistry.Models.UserAuthenticationUpdate 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; } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredAssetUpdateProperties 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.DeviceRegistry.Models.DiscoveredAssetUpdateProperties 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 UsernamePasswordCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DiscoveredDataPoint : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UsernamePasswordCredentials(string usernameReference, string passwordReference) { } - public string PasswordReference { get { throw null; } set { } } - public string UsernameReference { get { throw null; } set { } } + public DiscoveredDataPoint(string name, string dataSource) { } + public string DataPointConfiguration { get { throw null; } set { } } + public string DataSource { get { throw null; } set { } } + public System.DateTimeOffset? LastUpdatedOn { get { throw null; } set { } } + public string Name { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentials 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.DeviceRegistry.Models.UsernamePasswordCredentials 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; } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredDataPoint 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.DeviceRegistry.Models.DiscoveredDataPoint 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 UsernamePasswordCredentialsUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class DiscoveredDataset : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public UsernamePasswordCredentialsUpdate() { } - public string PasswordReference { get { throw null; } set { } } - public string UsernameReference { get { throw null; } set { } } + public DiscoveredDataset(string name) { } + public System.Collections.Generic.IList DataPoints { get { throw null; } } + public string DatasetConfiguration { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredDataset 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.DeviceRegistry.Models.DiscoveredDataset 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 DiscoveredEvent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DiscoveredEvent(string name, string eventNotifier) { } + public string EventConfiguration { get { throw null; } set { } } + public string EventNotifier { get { throw null; } set { } } + public System.DateTimeOffset? LastUpdatedOn { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DeviceRegistry.Models.DeviceRegistryTopic Topic { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.DiscoveredEvent 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.DeviceRegistry.Models.DiscoveredEvent 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 EventObservabilityMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventObservabilityMode(string value) { throw null; } + public static Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode Log { get { throw null; } } + public static Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode right) { throw null; } + public static implicit operator Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode left, Azure.ResourceManager.DeviceRegistry.Models.EventObservabilityMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MessageSchemaReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MessageSchemaReference() { } + public string SchemaName { get { throw null; } } + public string SchemaRegistryNamespace { get { throw null; } } + public string SchemaVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DeviceRegistry.Models.MessageSchemaReference 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.DeviceRegistry.Models.MessageSchemaReference 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 SchemaRegistryUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchemaRegistryUpdateProperties() { } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate 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.DeviceRegistry.Models.UsernamePasswordCredentialsUpdate 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; } + Azure.ResourceManager.DeviceRegistry.Models.SchemaRegistryUpdateProperties 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.DeviceRegistry.Models.SchemaRegistryUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetCollection.cs index c4fb4d216693..9fca956e22da 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetCollection.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetCollection.cs @@ -19,10 +19,10 @@ public partial class Sample_DeviceRegistryAssetCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateAnAssetWithExternalAssetId() + public async Task CreateOrUpdate_CreateAssetWithDiscoveredAssetRefs() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json - // this example is just showing the usage of "Assets_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + // this example is just showing the usage of "Asset_CreateOrReplace" 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(); @@ -43,44 +43,58 @@ public async Task CreateOrUpdate_CreateAnAssetWithExternalAssetId() string assetName = "my-asset"; DeviceRegistryAssetData data = new DeviceRegistryAssetData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) { - AssetType = "MyAssetType", - Enabled = true, - ExternalAssetId = "8ZBA6LRHU0A458969", - DisplayName = "AssetDisplayName", - Description = "This is a sample Asset", - AssetEndpointProfileUri = new Uri("https://www.example.com/myAssetEndpointProfile"), - Manufacturer = "Contoso", - ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), - Model = "ContosoModel", - ProductCode = "SA34VDG", - HardwareRevision = "1.0", - SoftwareRevision = "2.0", - DocumentationUri = new Uri("https://www.example.com/manual"), - SerialNumber = "64-103816-519918-8", - DefaultDataPointsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DataPoints = {new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") -{ -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = DataPointsObservabilityMode.Counter, + Properties = new AssetProperties("myAssetEndpointProfile") + { + IsEnabled = true, + ExternalAssetId = "8ZBA6LRHU0A458969", + DisplayName = "AssetDisplayName", + Description = "This is a sample Asset", + Manufacturer = "Contoso", + ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), + Model = "ContosoModel", + ProductCode = "SA34VDG", + HardwareRevision = "1.0", + SoftwareRevision = "2.0", + DocumentationUri = new Uri("https://www.example.com/manual"), + SerialNumber = "64-103816-519918-8", + DiscoveredAssetRefs = { "discoveredAsset1", "discoveredAsset2" }, + DefaultDatasetsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Keep, + }, + Datasets = {new DeviceRegistryDataset("dataset1") +{ +DatasetConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", +Topic = new DeviceRegistryTopic("/path/dataset1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +DataPoints = {new DeviceRegistryDataPoint("dataPoint1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") +{ +ObservabilityMode = DataPointObservabilityMode.Counter, DataPointConfiguration = "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}", -}, new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") +}, new DeviceRegistryDataPoint("dataPoint2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = DataPointsObservabilityMode.None, +ObservabilityMode = DataPointObservabilityMode.None, DataPointConfiguration = "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}", }}, - Events = {new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") +}}, + Events = {new DeviceRegistryEvent("event1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") { -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = EventsObservabilityMode.None, +ObservabilityMode = EventObservabilityMode.None, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}", -}, new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +Topic = new DeviceRegistryTopic("/path/event1") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = EventsObservabilityMode.Log, +Retain = DeviceRegistryTopicRetainType.Keep, +}, +}, new DeviceRegistryEvent("event2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +{ +ObservabilityMode = EventObservabilityMode.Log, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}", }}, + }, Tags = { ["site"] = "building-1" @@ -98,10 +112,10 @@ public async Task CreateOrUpdate_CreateAnAssetWithExternalAssetId() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateAnAssetWithoutDisplayName() + public async Task CreateOrUpdate_CreateAssetWithExternalAssetId() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json - // this example is just showing the usage of "Assets_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json + // this example is just showing the usage of "Asset_CreateOrReplace" 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(); @@ -122,43 +136,57 @@ public async Task CreateOrUpdate_CreateAnAssetWithoutDisplayName() string assetName = "my-asset"; DeviceRegistryAssetData data = new DeviceRegistryAssetData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) { - AssetType = "MyAssetType", - Enabled = true, - ExternalAssetId = "8ZBA6LRHU0A458969", - Description = "This is a sample Asset", - AssetEndpointProfileUri = new Uri("https://www.example.com/myAssetEndpointProfile"), - Manufacturer = "Contoso", - ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), - Model = "ContosoModel", - ProductCode = "SA34VDG", - HardwareRevision = "1.0", - SoftwareRevision = "2.0", - DocumentationUri = new Uri("https://www.example.com/manual"), - SerialNumber = "64-103816-519918-8", - DefaultDataPointsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DataPoints = {new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") -{ -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = DataPointsObservabilityMode.Counter, + Properties = new AssetProperties("myAssetEndpointProfile") + { + IsEnabled = true, + ExternalAssetId = "8ZBA6LRHU0A458969", + DisplayName = "AssetDisplayName", + Description = "This is a sample Asset", + Manufacturer = "Contoso", + ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), + Model = "ContosoModel", + ProductCode = "SA34VDG", + HardwareRevision = "1.0", + SoftwareRevision = "2.0", + DocumentationUri = new Uri("https://www.example.com/manual"), + SerialNumber = "64-103816-519918-8", + DefaultDatasetsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Keep, + }, + Datasets = {new DeviceRegistryDataset("dataset1") +{ +DatasetConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", +Topic = new DeviceRegistryTopic("/path/dataset1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +DataPoints = {new DeviceRegistryDataPoint("dataPoint1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") +{ +ObservabilityMode = DataPointObservabilityMode.Counter, DataPointConfiguration = "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}", -}, new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") +}, new DeviceRegistryDataPoint("dataPoint2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = DataPointsObservabilityMode.None, +ObservabilityMode = DataPointObservabilityMode.None, DataPointConfiguration = "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}", }}, - Events = {new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") +}}, + Events = {new DeviceRegistryEvent("event1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") { -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = EventsObservabilityMode.None, +ObservabilityMode = EventObservabilityMode.None, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}", -}, new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +Topic = new DeviceRegistryTopic("/path/event1") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = EventsObservabilityMode.Log, +Retain = DeviceRegistryTopicRetainType.Keep, +}, +}, new DeviceRegistryEvent("event2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +{ +ObservabilityMode = EventObservabilityMode.Log, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}", }}, + }, Tags = { ["site"] = "building-1" @@ -176,10 +204,10 @@ public async Task CreateOrUpdate_CreateAnAssetWithoutDisplayName() [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateAnAssetWithoutExternalAssetId() + public async Task CreateOrUpdate_CreateAssetWithoutDisplayName() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json - // this example is just showing the usage of "Assets_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Create_Asset_Without_DisplayName.json + // this example is just showing the usage of "Asset_CreateOrReplace" 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(); @@ -200,43 +228,147 @@ public async Task CreateOrUpdate_CreateAnAssetWithoutExternalAssetId() string assetName = "my-asset"; DeviceRegistryAssetData data = new DeviceRegistryAssetData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) { - AssetType = "MyAssetType", - Enabled = true, - DisplayName = "AssetDisplayName", - Description = "This is a sample Asset", - AssetEndpointProfileUri = new Uri("https://www.example.com/myAssetEndpointProfile"), - Manufacturer = "Contoso", - ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), - Model = "ContosoModel", - ProductCode = "SA34VDG", - HardwareRevision = "1.0", - SoftwareRevision = "2.0", - DocumentationUri = new Uri("https://www.example.com/manual"), - SerialNumber = "64-103816-519918-8", - DefaultDataPointsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", - DataPoints = {new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") -{ -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = DataPointsObservabilityMode.Counter, + Properties = new AssetProperties("myAssetEndpointProfile") + { + IsEnabled = true, + ExternalAssetId = "8ZBA6LRHU0A458969", + Description = "This is a sample Asset", + Manufacturer = "Contoso", + ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), + Model = "ContosoModel", + ProductCode = "SA34VDG", + HardwareRevision = "1.0", + SoftwareRevision = "2.0", + DocumentationUri = new Uri("https://www.example.com/manual"), + SerialNumber = "64-103816-519918-8", + DefaultDatasetsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Keep, + }, + Datasets = {new DeviceRegistryDataset("dataset1") +{ +DatasetConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", +Topic = new DeviceRegistryTopic("/path/dataset1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +DataPoints = {new DeviceRegistryDataPoint("dataPoint1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") +{ +ObservabilityMode = DataPointObservabilityMode.Counter, DataPointConfiguration = "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}", -}, new DataPoint("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") +}, new DeviceRegistryDataPoint("dataPoint2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = DataPointsObservabilityMode.None, +ObservabilityMode = DataPointObservabilityMode.None, DataPointConfiguration = "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}", }}, - Events = {new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") +}}, + Events = {new DeviceRegistryEvent("event1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") { -CapabilityId = "dtmi:com:example:Thermostat:__temperature;1", -ObservabilityMode = EventsObservabilityMode.None, +ObservabilityMode = EventObservabilityMode.None, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}", -}, new AssetEvent("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +Topic = new DeviceRegistryTopic("/path/event1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +}, new DeviceRegistryEvent("event2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +{ +ObservabilityMode = EventObservabilityMode.Log, +EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}", +}}, + }, + Tags = +{ +["site"] = "building-1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, assetName, data); + DeviceRegistryAssetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryAssetData 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 CreateOrUpdate_CreateAssetWithoutExternalAssetId() + { + // Generated from example definition: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json + // this example is just showing the usage of "Asset_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryAssetResource + DeviceRegistryAssetCollection collection = resourceGroupResource.GetDeviceRegistryAssets(); + + // invoke the operation + string assetName = "my-asset"; + DeviceRegistryAssetData data = new DeviceRegistryAssetData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + { + Properties = new AssetProperties("myAssetEndpointProfile") + { + IsEnabled = true, + DisplayName = "AssetDisplayName", + Description = "This is a sample Asset", + Manufacturer = "Contoso", + ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), + Model = "ContosoModel", + ProductCode = "SA34VDG", + HardwareRevision = "1.0", + SoftwareRevision = "2.0", + DocumentationUri = new Uri("https://www.example.com/manual"), + SerialNumber = "64-103816-519918-8", + DefaultDatasetsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Keep, + }, + Datasets = {new DeviceRegistryDataset("dataset1") +{ +DatasetConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", +Topic = new DeviceRegistryTopic("/path/dataset1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +DataPoints = {new DeviceRegistryDataPoint("dataPoint1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") +{ +ObservabilityMode = DataPointObservabilityMode.Counter, +DataPointConfiguration = "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}", +}, new DeviceRegistryDataPoint("dataPoint2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") +{ +ObservabilityMode = DataPointObservabilityMode.None, +DataPointConfiguration = "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}", +}}, +}}, + Events = {new DeviceRegistryEvent("event1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") +{ +ObservabilityMode = EventObservabilityMode.None, +EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}", +Topic = new DeviceRegistryTopic("/path/event1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +}, new DeviceRegistryEvent("event2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") { -CapabilityId = "dtmi:com:example:Thermostat:__pressure;1", -ObservabilityMode = EventsObservabilityMode.Log, +ObservabilityMode = EventObservabilityMode.Log, EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}", }}, + }, Tags = { ["site"] = "building-1" @@ -254,10 +386,10 @@ public async Task CreateOrUpdate_CreateAnAssetWithoutExternalAssetId() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAsset() + public async Task Get_GetAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset.json + // this example is just showing the usage of "Asset_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(); @@ -287,10 +419,10 @@ public async Task Get_GetAnAsset() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAssetWithSyncStatus() + public async Task Get_GetAssetWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset_With_SyncStatus.json + // this example is just showing the usage of "Asset_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(); @@ -320,10 +452,10 @@ public async Task Get_GetAnAssetWithSyncStatus() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_ListAssetsInAResourceGroup() + public async Task GetAll_ListAssetsResourceGroup() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json - // this example is just showing the usage of "Assets_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/List_Assets_ResourceGroup.json + // this example is just showing the usage of "Asset_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -355,10 +487,10 @@ public async Task GetAll_ListAssetsInAResourceGroup() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_GetAnAsset() + public async Task Exists_GetAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset.json + // this example is just showing the usage of "Asset_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(); @@ -384,10 +516,10 @@ public async Task Exists_GetAnAsset() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_GetAnAssetWithSyncStatus() + public async Task Exists_GetAssetWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset_With_SyncStatus.json + // this example is just showing the usage of "Asset_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(); @@ -413,10 +545,10 @@ public async Task Exists_GetAnAssetWithSyncStatus() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_GetAnAsset() + public async Task GetIfExists_GetAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset.json + // this example is just showing the usage of "Asset_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(); @@ -454,10 +586,10 @@ public async Task GetIfExists_GetAnAsset() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_GetAnAssetWithSyncStatus() + public async Task GetIfExists_GetAssetWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset_With_SyncStatus.json + // this example is just showing the usage of "Asset_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(); diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileCollection.cs index ff327927f96e..305a6d8dbc7c 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileCollection.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileCollection.cs @@ -19,10 +19,10 @@ public partial class Sample_DeviceRegistryAssetEndpointProfileCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateAnAssetEndpointProfile() + public async Task CreateOrUpdate_CreateAssetEndpointProfile() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Create_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_CreateOrReplace" 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(); @@ -43,8 +43,10 @@ public async Task CreateOrUpdate_CreateAnAssetEndpointProfile() string assetEndpointProfileName = "my-assetendpointprofile"; DeviceRegistryAssetEndpointProfileData data = new DeviceRegistryAssetEndpointProfileData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) { - TargetAddress = new Uri("https://www.example.com/myTargetAddress"), - UserAuthentication = new UserAuthentication(UserAuthenticationMode.Anonymous), + Properties = new DeviceRegistryAssetEndpointProfileProperties(new Uri("https://www.example.com/myTargetAddress"), "myEndpointProfileType") + { + Authentication = new DeviceRegistryAuthentication(AuthenticationMethod.Anonymous), + }, Tags = { ["site"] = "building-1" @@ -62,10 +64,89 @@ public async Task CreateOrUpdate_CreateAnAssetEndpointProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAssetEndpointProfile() + public async Task CreateOrUpdate_CreateAssetEndpointProfileWithDiscoveredAepRef() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + // this example is just showing the usage of "AssetEndpointProfile_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryAssetEndpointProfileResource + DeviceRegistryAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryAssetEndpointProfiles(); + + // invoke the operation + string assetEndpointProfileName = "my-assetendpointprofile"; + DeviceRegistryAssetEndpointProfileData data = new DeviceRegistryAssetEndpointProfileData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + { + Properties = new DeviceRegistryAssetEndpointProfileProperties(new Uri("https://www.example.com/myTargetAddress"), "myEndpointProfileType") + { + Authentication = new DeviceRegistryAuthentication(AuthenticationMethod.Anonymous), + DiscoveredAssetEndpointProfileRef = "discoveredAssetEndpointProfile1", + }, + Tags = +{ +["site"] = "building-1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, assetEndpointProfileName, data); + DeviceRegistryAssetEndpointProfileResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryAssetEndpointProfileData 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 Get_GetAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryAssetEndpointProfileResource + DeviceRegistryAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryAssetEndpointProfiles(); + + // invoke the operation + string assetEndpointProfileName = "my-assetendpointprofile"; + DeviceRegistryAssetEndpointProfileResource result = await collection.GetAsync(assetEndpointProfileName); + + // 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 + DeviceRegistryAssetEndpointProfileData 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 Get_GetAssetEndpointProfileWithSyncStatus() + { + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + // this example is just showing the usage of "AssetEndpointProfile_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(); @@ -95,10 +176,10 @@ public async Task Get_GetAnAssetEndpointProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_ListAssetEndpointProfilesInAResourceGroup() + public async Task GetAll_ListAssetEndpointProfilesResourceGroup() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json - // this example is just showing the usage of "AssetEndpointProfiles_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json + // this example is just showing the usage of "AssetEndpointProfile_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -130,10 +211,10 @@ public async Task GetAll_ListAssetEndpointProfilesInAResourceGroup() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_GetAnAssetEndpointProfile() + public async Task Exists_GetAssetEndpointProfile() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_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(); @@ -159,10 +240,80 @@ public async Task Exists_GetAnAssetEndpointProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_GetAnAssetEndpointProfile() + public async Task Exists_GetAssetEndpointProfileWithSyncStatus() + { + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + // this example is just showing the usage of "AssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryAssetEndpointProfileResource + DeviceRegistryAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryAssetEndpointProfiles(); + + // invoke the operation + string assetEndpointProfileName = "my-assetendpointprofile"; + bool result = await collection.ExistsAsync(assetEndpointProfileName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryAssetEndpointProfileResource + DeviceRegistryAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryAssetEndpointProfiles(); + + // invoke the operation + string assetEndpointProfileName = "my-assetendpointprofile"; + NullableResponse response = await collection.GetIfExistsAsync(assetEndpointProfileName); + DeviceRegistryAssetEndpointProfileResource 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 + DeviceRegistryAssetEndpointProfileData 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 GetIfExists_GetAssetEndpointProfileWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + // this example is just showing the usage of "AssetEndpointProfile_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(); diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileResource.cs index b5b6afe3628a..b05163bf29cd 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetEndpointProfileResource.cs @@ -18,10 +18,10 @@ public partial class Sample_DeviceRegistryAssetEndpointProfileResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAssetEndpointProfile() + public async Task Get_GetAssetEndpointProfile() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_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(); @@ -48,10 +48,40 @@ public async Task Get_GetAnAssetEndpointProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_DeleteAnAssetEndpointProfile() + public async Task Get_GetAssetEndpointProfileWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + // this example is just showing the usage of "AssetEndpointProfile_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 DeviceRegistryAssetEndpointProfileResource created on azure + // for more information of creating DeviceRegistryAssetEndpointProfileResource, please refer to the document of DeviceRegistryAssetEndpointProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string assetEndpointProfileName = "my-assetendpointprofile"; + ResourceIdentifier deviceRegistryAssetEndpointProfileResourceId = DeviceRegistryAssetEndpointProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, assetEndpointProfileName); + DeviceRegistryAssetEndpointProfileResource deviceRegistryAssetEndpointProfile = client.GetDeviceRegistryAssetEndpointProfileResource(deviceRegistryAssetEndpointProfileResourceId); + + // invoke the operation + DeviceRegistryAssetEndpointProfileResource result = await deviceRegistryAssetEndpointProfile.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 + DeviceRegistryAssetEndpointProfileData 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 Delete_DeleteAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Delete_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -74,10 +104,10 @@ public async Task Delete_DeleteAnAssetEndpointProfile() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_PatchAnAssetEndpointProfile() + public async Task Update_UpdateAssetEndpointProfile() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json - // this example is just showing the usage of "AssetEndpointProfiles_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Update_AssetEndpointProfile.json + // this example is just showing the usage of "AssetEndpointProfile_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -95,7 +125,10 @@ public async Task Update_PatchAnAssetEndpointProfile() // invoke the operation DeviceRegistryAssetEndpointProfilePatch patch = new DeviceRegistryAssetEndpointProfilePatch { - TargetAddress = new Uri("https://www.example.com/myTargetAddress"), + Properties = new AssetEndpointProfileUpdateProperties + { + TargetAddress = new Uri("https://www.example.com/myTargetAddress"), + }, }; ArmOperation lro = await deviceRegistryAssetEndpointProfile.UpdateAsync(WaitUntil.Completed, patch); DeviceRegistryAssetEndpointProfileResource result = lro.Value; diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetResource.cs index d876ee4ffa39..0cc013e53b30 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryAssetResource.cs @@ -18,10 +18,10 @@ public partial class Sample_DeviceRegistryAssetResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAsset() + public async Task Get_GetAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset.json + // this example is just showing the usage of "Asset_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(); @@ -48,10 +48,10 @@ public async Task Get_GetAnAsset() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_GetAnAssetWithSyncStatus() + public async Task Get_GetAssetWithSyncStatus() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json - // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Get_Asset_With_SyncStatus.json + // this example is just showing the usage of "Asset_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(); @@ -78,10 +78,10 @@ public async Task Get_GetAnAssetWithSyncStatus() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_DeleteAnAsset() + public async Task Delete_DeleteAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json - // this example is just showing the usage of "Assets_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Delete_Asset.json + // this example is just showing the usage of "Asset_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -104,10 +104,10 @@ public async Task Delete_DeleteAnAsset() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_PatchAnAsset() + public async Task Update_UpdateAsset() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json - // this example is just showing the usage of "Assets_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/Update_Asset.json + // this example is just showing the usage of "Asset_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -125,8 +125,11 @@ public async Task Update_PatchAnAsset() // invoke the operation DeviceRegistryAssetPatch patch = new DeviceRegistryAssetPatch { - Enabled = false, - DisplayName = "NewAssetDisplayName", + Properties = new AssetUpdateProperties + { + IsEnabled = false, + DisplayName = "NewAssetDisplayName", + }, }; ArmOperation lro = await deviceRegistryAsset.UpdateAsync(WaitUntil.Completed, patch); DeviceRegistryAssetResource result = lro.Value; diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerCollection.cs new file mode 100644 index 000000000000..4f7ecc39d9db --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerCollection.cs @@ -0,0 +1,153 @@ +// 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.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryBillingContainerCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetBillingContainer() + { + // Generated from example definition: 2024-09-01-preview/Get_BillingContainer.json + // this example is just showing the usage of "BillingContainer_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 DeviceRegistryBillingContainerResource + DeviceRegistryBillingContainerCollection collection = subscriptionResource.GetDeviceRegistryBillingContainers(); + + // invoke the operation + string billingContainerName = "my-billingContainer"; + DeviceRegistryBillingContainerResource result = await collection.GetAsync(billingContainerName); + + // 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 + DeviceRegistryBillingContainerData 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 GetAll_ListBillingContainersSubscription() + { + // Generated from example definition: 2024-09-01-preview/List_BillingContainers_Subscription.json + // this example is just showing the usage of "BillingContainer_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeviceRegistryBillingContainerResource + DeviceRegistryBillingContainerCollection collection = subscriptionResource.GetDeviceRegistryBillingContainers(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistryBillingContainerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryBillingContainerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetBillingContainer() + { + // Generated from example definition: 2024-09-01-preview/Get_BillingContainer.json + // this example is just showing the usage of "BillingContainer_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 DeviceRegistryBillingContainerResource + DeviceRegistryBillingContainerCollection collection = subscriptionResource.GetDeviceRegistryBillingContainers(); + + // invoke the operation + string billingContainerName = "my-billingContainer"; + bool result = await collection.ExistsAsync(billingContainerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetBillingContainer() + { + // Generated from example definition: 2024-09-01-preview/Get_BillingContainer.json + // this example is just showing the usage of "BillingContainer_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 DeviceRegistryBillingContainerResource + DeviceRegistryBillingContainerCollection collection = subscriptionResource.GetDeviceRegistryBillingContainers(); + + // invoke the operation + string billingContainerName = "my-billingContainer"; + NullableResponse response = await collection.GetIfExistsAsync(billingContainerName); + DeviceRegistryBillingContainerResource 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 + DeviceRegistryBillingContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerResource.cs new file mode 100644 index 000000000000..1b6a22f1cd99 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryBillingContainerResource.cs @@ -0,0 +1,47 @@ +// 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 NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryBillingContainerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetBillingContainer() + { + // Generated from example definition: 2024-09-01-preview/Get_BillingContainer.json + // this example is just showing the usage of "BillingContainer_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 DeviceRegistryBillingContainerResource created on azure + // for more information of creating DeviceRegistryBillingContainerResource, please refer to the document of DeviceRegistryBillingContainerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string billingContainerName = "my-billingContainer"; + ResourceIdentifier deviceRegistryBillingContainerResourceId = DeviceRegistryBillingContainerResource.CreateResourceIdentifier(subscriptionId, billingContainerName); + DeviceRegistryBillingContainerResource deviceRegistryBillingContainer = client.GetDeviceRegistryBillingContainerResource(deviceRegistryBillingContainerResourceId); + + // invoke the operation + DeviceRegistryBillingContainerResource result = await deviceRegistryBillingContainer.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 + DeviceRegistryBillingContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetCollection.cs new file mode 100644 index 000000000000..ceec191f5387 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetCollection.cs @@ -0,0 +1,242 @@ +// 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.DeviceRegistry.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryDiscoveredAssetCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Create_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetResource + DeviceRegistryDiscoveredAssetCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssets(); + + // invoke the operation + string discoveredAssetName = "my-discoveredasset"; + DeviceRegistryDiscoveredAssetData data = new DeviceRegistryDiscoveredAssetData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + { + Properties = new DeviceRegistryDiscoveredAssetProperties("myAssetEndpointProfile", "11111111-1111-1111-1111-111111111111", 73766L) + { + Manufacturer = "Contoso", + ManufacturerUri = new Uri("https://www.contoso.com/manufacturerUri"), + Model = "ContosoModel", + ProductCode = "SA34VDG", + HardwareRevision = "1.0", + SoftwareRevision = "2.0", + DocumentationUri = new Uri("https://www.example.com/manual"), + SerialNumber = "64-103816-519918-8", + DefaultDatasetsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultEventsConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Keep, + }, + Datasets = {new DiscoveredDataset("dataset1") +{ +DatasetConfiguration = "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}", +Topic = new DeviceRegistryTopic("/path/dataset1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +DataPoints = {new DiscoveredDataPoint("dataPoint1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") +{ +DataPointConfiguration = "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}", +}, new DiscoveredDataPoint("dataPoint2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") +{ +DataPointConfiguration = "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}", +}}, +}}, + Events = {new DiscoveredEvent("event1", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") +{ +EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}", +Topic = new DeviceRegistryTopic("/path/event1") +{ +Retain = DeviceRegistryTopicRetainType.Keep, +}, +}, new DiscoveredEvent("event2", "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") +{ +EventConfiguration = "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}", +}}, + }, + Tags = +{ +["site"] = "building-1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, discoveredAssetName, data); + DeviceRegistryDiscoveredAssetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetData 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 Get_GetDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetResource + DeviceRegistryDiscoveredAssetCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssets(); + + // invoke the operation + string discoveredAssetName = "my-discoveredasset"; + DeviceRegistryDiscoveredAssetResource result = await collection.GetAsync(discoveredAssetName); + + // 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 + DeviceRegistryDiscoveredAssetData 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 GetAll_ListDiscoveredAssetsResourceGroup() + { + // Generated from example definition: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + // this example is just showing the usage of "DiscoveredAsset_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetResource + DeviceRegistryDiscoveredAssetCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssets(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistryDiscoveredAssetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetResource + DeviceRegistryDiscoveredAssetCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssets(); + + // invoke the operation + string discoveredAssetName = "my-discoveredasset"; + bool result = await collection.ExistsAsync(discoveredAssetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetResource + DeviceRegistryDiscoveredAssetCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssets(); + + // invoke the operation + string discoveredAssetName = "my-discoveredasset"; + NullableResponse response = await collection.GetIfExistsAsync(discoveredAssetName); + DeviceRegistryDiscoveredAssetResource 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 + DeviceRegistryDiscoveredAssetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs new file mode 100644 index 000000000000..3051a7a17adc --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs @@ -0,0 +1,204 @@ +// 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.DeviceRegistry.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryDiscoveredAssetEndpointProfileCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetEndpointProfileResource + DeviceRegistryDiscoveredAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + + // invoke the operation + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + DeviceRegistryDiscoveredAssetEndpointProfileData data = new DeviceRegistryDiscoveredAssetEndpointProfileData(new AzureLocation("West Europe"), new DeviceRegistryExtendedLocation("CustomLocation", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + { + Properties = new DiscoveredAssetEndpointProfileProperties(new Uri("https://www.example.com/myTargetAddress"), "myEndpointProfileType", "11111111-1111-1111-1111-111111111111", 73766L) + { + AdditionalConfiguration = "{\"foo\": \"bar\"}", + SupportedAuthenticationMethods = { AuthenticationMethod.Anonymous, AuthenticationMethod.Certificate, AuthenticationMethod.UsernamePassword }, + }, + Tags = +{ +["site"] = "building-1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, discoveredAssetEndpointProfileName, data); + DeviceRegistryDiscoveredAssetEndpointProfileResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetEndpointProfileData 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 Get_GetDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetEndpointProfileResource + DeviceRegistryDiscoveredAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + + // invoke the operation + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + DeviceRegistryDiscoveredAssetEndpointProfileResource result = await collection.GetAsync(discoveredAssetEndpointProfileName); + + // 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 + DeviceRegistryDiscoveredAssetEndpointProfileData 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 GetAll_ListDiscoveredAssetEndpointProfilesResourceGroup() + { + // Generated from example definition: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetEndpointProfileResource + DeviceRegistryDiscoveredAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistryDiscoveredAssetEndpointProfileResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetEndpointProfileData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetEndpointProfileResource + DeviceRegistryDiscoveredAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + + // invoke the operation + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + bool result = await collection.ExistsAsync(discoveredAssetEndpointProfileName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistryDiscoveredAssetEndpointProfileResource + DeviceRegistryDiscoveredAssetEndpointProfileCollection collection = resourceGroupResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + + // invoke the operation + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + NullableResponse response = await collection.GetIfExistsAsync(discoveredAssetEndpointProfileName); + DeviceRegistryDiscoveredAssetEndpointProfileResource 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 + DeviceRegistryDiscoveredAssetEndpointProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileResource.cs new file mode 100644 index 000000000000..33f8986e433a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetEndpointProfileResource.cs @@ -0,0 +1,118 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryDiscoveredAssetEndpointProfileResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_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 DeviceRegistryDiscoveredAssetEndpointProfileResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetEndpointProfileResource, please refer to the document of DeviceRegistryDiscoveredAssetEndpointProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + ResourceIdentifier deviceRegistryDiscoveredAssetEndpointProfileResourceId = DeviceRegistryDiscoveredAssetEndpointProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + DeviceRegistryDiscoveredAssetEndpointProfileResource deviceRegistryDiscoveredAssetEndpointProfile = client.GetDeviceRegistryDiscoveredAssetEndpointProfileResource(deviceRegistryDiscoveredAssetEndpointProfileResourceId); + + // invoke the operation + DeviceRegistryDiscoveredAssetEndpointProfileResource result = await deviceRegistryDiscoveredAssetEndpointProfile.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 + DeviceRegistryDiscoveredAssetEndpointProfileData 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 Delete_DeleteDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistryDiscoveredAssetEndpointProfileResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetEndpointProfileResource, please refer to the document of DeviceRegistryDiscoveredAssetEndpointProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + ResourceIdentifier deviceRegistryDiscoveredAssetEndpointProfileResourceId = DeviceRegistryDiscoveredAssetEndpointProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + DeviceRegistryDiscoveredAssetEndpointProfileResource deviceRegistryDiscoveredAssetEndpointProfile = client.GetDeviceRegistryDiscoveredAssetEndpointProfileResource(deviceRegistryDiscoveredAssetEndpointProfileResourceId); + + // invoke the operation + await deviceRegistryDiscoveredAssetEndpointProfile.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateDiscoveredAssetEndpointProfile() + { + // Generated from example definition: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistryDiscoveredAssetEndpointProfileResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetEndpointProfileResource, please refer to the document of DeviceRegistryDiscoveredAssetEndpointProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetEndpointProfileName = "my-discoveredassetendpointprofile"; + ResourceIdentifier deviceRegistryDiscoveredAssetEndpointProfileResourceId = DeviceRegistryDiscoveredAssetEndpointProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + DeviceRegistryDiscoveredAssetEndpointProfileResource deviceRegistryDiscoveredAssetEndpointProfile = client.GetDeviceRegistryDiscoveredAssetEndpointProfileResource(deviceRegistryDiscoveredAssetEndpointProfileResourceId); + + // invoke the operation + DeviceRegistryDiscoveredAssetEndpointProfilePatch patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch + { + Properties = new DiscoveredAssetEndpointProfileUpdateProperties + { + TargetAddress = new Uri("https://www.example.com/myTargetAddress"), + AdditionalConfiguration = "{\"foo\": \"bar\"}", + SupportedAuthenticationMethods = { AuthenticationMethod.Anonymous, AuthenticationMethod.Certificate }, + EndpointProfileType = "myEndpointProfileType", + DiscoveryId = "11111111-1111-1111-1111-111111111111", + Version = 73766L, + }, + }; + ArmOperation lro = await deviceRegistryDiscoveredAssetEndpointProfile.UpdateAsync(WaitUntil.Completed, patch); + DeviceRegistryDiscoveredAssetEndpointProfileResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetEndpointProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetResource.cs new file mode 100644 index 000000000000..23532c57d936 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistryDiscoveredAssetResource.cs @@ -0,0 +1,117 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistryDiscoveredAssetResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Get_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_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 DeviceRegistryDiscoveredAssetResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetResource, please refer to the document of DeviceRegistryDiscoveredAssetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetName = "my-discoveredasset"; + ResourceIdentifier deviceRegistryDiscoveredAssetResourceId = DeviceRegistryDiscoveredAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetName); + DeviceRegistryDiscoveredAssetResource deviceRegistryDiscoveredAsset = client.GetDeviceRegistryDiscoveredAssetResource(deviceRegistryDiscoveredAssetResourceId); + + // invoke the operation + DeviceRegistryDiscoveredAssetResource result = await deviceRegistryDiscoveredAsset.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 + DeviceRegistryDiscoveredAssetData 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 Delete_DeleteDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Delete_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistryDiscoveredAssetResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetResource, please refer to the document of DeviceRegistryDiscoveredAssetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetName = "my-discoveredasset"; + ResourceIdentifier deviceRegistryDiscoveredAssetResourceId = DeviceRegistryDiscoveredAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetName); + DeviceRegistryDiscoveredAssetResource deviceRegistryDiscoveredAsset = client.GetDeviceRegistryDiscoveredAssetResource(deviceRegistryDiscoveredAssetResourceId); + + // invoke the operation + await deviceRegistryDiscoveredAsset.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateDiscoveredAsset() + { + // Generated from example definition: 2024-09-01-preview/Update_DiscoveredAsset.json + // this example is just showing the usage of "DiscoveredAsset_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistryDiscoveredAssetResource created on azure + // for more information of creating DeviceRegistryDiscoveredAssetResource, please refer to the document of DeviceRegistryDiscoveredAssetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string discoveredAssetName = "my-discoveredasset"; + ResourceIdentifier deviceRegistryDiscoveredAssetResourceId = DeviceRegistryDiscoveredAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, discoveredAssetName); + DeviceRegistryDiscoveredAssetResource deviceRegistryDiscoveredAsset = client.GetDeviceRegistryDiscoveredAssetResource(deviceRegistryDiscoveredAssetResourceId); + + // invoke the operation + DeviceRegistryDiscoveredAssetPatch patch = new DeviceRegistryDiscoveredAssetPatch + { + Properties = new DiscoveredAssetUpdateProperties + { + DocumentationUri = new Uri("https://www.example.com/manual-2"), + DefaultTopic = new DeviceRegistryTopic("/path/defaultTopic") + { + Retain = DeviceRegistryTopicRetainType.Never, + }, + }, + }; + ArmOperation lro = await deviceRegistryDiscoveredAsset.UpdateAsync(WaitUntil.Completed, patch); + DeviceRegistryDiscoveredAssetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaCollection.cs new file mode 100644 index 000000000000..ee1299ef824d --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaCollection.cs @@ -0,0 +1,208 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateSchema() + { + // Generated from example definition: 2024-09-01-preview/Create_Schema.json + // this example is just showing the usage of "Schema_CreateOrReplace" 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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // get the collection of this DeviceRegistrySchemaResource + DeviceRegistrySchemaCollection collection = deviceRegistrySchemaRegistry.GetDeviceRegistrySchemas(); + + // invoke the operation + string schemaName = "my-schema"; + DeviceRegistrySchemaData data = new DeviceRegistrySchemaData + { + Properties = new DeviceRegistrySchemaProperties(DeviceRegistrySchemaFormat.JsonSchemaDraft7, DeviceRegistrySchemaType.MessageSchema) + { + DisplayName = "My Schema", + Description = "This is a sample Schema", + Tags = +{ +["sampleKey"] = "sampleValue" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaName, data); + DeviceRegistrySchemaResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaData 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 Get_SchemasGet() + { + // Generated from example definition: 2024-09-01-preview/Get_Schema.json + // this example is just showing the usage of "Schema_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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // get the collection of this DeviceRegistrySchemaResource + DeviceRegistrySchemaCollection collection = deviceRegistrySchemaRegistry.GetDeviceRegistrySchemas(); + + // invoke the operation + string schemaName = "my-schema"; + DeviceRegistrySchemaResource result = await collection.GetAsync(schemaName); + + // 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 + DeviceRegistrySchemaData 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 GetAll_ListSchemasSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + // this example is just showing the usage of "Schema_ListBySchemaRegistry" 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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // get the collection of this DeviceRegistrySchemaResource + DeviceRegistrySchemaCollection collection = deviceRegistrySchemaRegistry.GetDeviceRegistrySchemas(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistrySchemaResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_SchemasGet() + { + // Generated from example definition: 2024-09-01-preview/Get_Schema.json + // this example is just showing the usage of "Schema_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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // get the collection of this DeviceRegistrySchemaResource + DeviceRegistrySchemaCollection collection = deviceRegistrySchemaRegistry.GetDeviceRegistrySchemas(); + + // invoke the operation + string schemaName = "my-schema"; + bool result = await collection.ExistsAsync(schemaName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SchemasGet() + { + // Generated from example definition: 2024-09-01-preview/Get_Schema.json + // this example is just showing the usage of "Schema_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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // get the collection of this DeviceRegistrySchemaResource + DeviceRegistrySchemaCollection collection = deviceRegistrySchemaRegistry.GetDeviceRegistrySchemas(); + + // invoke the operation + string schemaName = "my-schema"; + NullableResponse response = await collection.GetIfExistsAsync(schemaName); + DeviceRegistrySchemaResource 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 + DeviceRegistrySchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryCollection.cs new file mode 100644 index 000000000000..da5744529c2b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryCollection.cs @@ -0,0 +1,203 @@ +// 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.DeviceRegistry.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaRegistryCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Create_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_CreateOrReplace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistrySchemaRegistryResource + DeviceRegistrySchemaRegistryCollection collection = resourceGroupResource.GetDeviceRegistrySchemaRegistries(); + + // invoke the operation + string schemaRegistryName = "my-schema-registry"; + DeviceRegistrySchemaRegistryData data = new DeviceRegistrySchemaRegistryData(new AzureLocation("West Europe")) + { + Properties = new DeviceRegistrySchemaRegistryProperties("sr-namespace-001", new Uri("my-blob-storage.blob.core.windows.net/my-container")) + { + DisplayName = "Schema Registry namespace 001", + Description = "This is a sample Schema Registry", + }, + Identity = new ManagedServiceIdentity("None"), + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaRegistryName, data); + DeviceRegistrySchemaRegistryResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaRegistryData 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 Get_GetSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistrySchemaRegistryResource + DeviceRegistrySchemaRegistryCollection collection = resourceGroupResource.GetDeviceRegistrySchemaRegistries(); + + // invoke the operation + string schemaRegistryName = "my-schema-registry"; + DeviceRegistrySchemaRegistryResource result = await collection.GetAsync(schemaRegistryName); + + // 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 + DeviceRegistrySchemaRegistryData 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 GetAll_ListSchemaRegistriesResourceGroup() + { + // Generated from example definition: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + // this example is just showing the usage of "SchemaRegistry_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistrySchemaRegistryResource + DeviceRegistrySchemaRegistryCollection collection = resourceGroupResource.GetDeviceRegistrySchemaRegistries(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistrySchemaRegistryResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaRegistryData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistrySchemaRegistryResource + DeviceRegistrySchemaRegistryCollection collection = resourceGroupResource.GetDeviceRegistrySchemaRegistries(); + + // invoke the operation + string schemaRegistryName = "my-schema-registry"; + bool result = await collection.ExistsAsync(schemaRegistryName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceRegistrySchemaRegistryResource + DeviceRegistrySchemaRegistryCollection collection = resourceGroupResource.GetDeviceRegistrySchemaRegistries(); + + // invoke the operation + string schemaRegistryName = "my-schema-registry"; + NullableResponse response = await collection.GetIfExistsAsync(schemaRegistryName); + DeviceRegistrySchemaRegistryResource 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 + DeviceRegistrySchemaRegistryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryResource.cs new file mode 100644 index 000000000000..b371a949a256 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaRegistryResource.cs @@ -0,0 +1,115 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaRegistryResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_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 DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // invoke the operation + DeviceRegistrySchemaRegistryResource result = await deviceRegistrySchemaRegistry.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 + DeviceRegistrySchemaRegistryData 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 Delete_DeleteSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Delete_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // invoke the operation + await deviceRegistrySchemaRegistry.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateSchemaRegistry() + { + // Generated from example definition: 2024-09-01-preview/Update_SchemaRegistry.json + // this example is just showing the usage of "SchemaRegistry_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistrySchemaRegistryResource created on azure + // for more information of creating DeviceRegistrySchemaRegistryResource, please refer to the document of DeviceRegistrySchemaRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + ResourceIdentifier deviceRegistrySchemaRegistryResourceId = DeviceRegistrySchemaRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName); + DeviceRegistrySchemaRegistryResource deviceRegistrySchemaRegistry = client.GetDeviceRegistrySchemaRegistryResource(deviceRegistrySchemaRegistryResourceId); + + // invoke the operation + DeviceRegistrySchemaRegistryPatch patch = new DeviceRegistrySchemaRegistryPatch + { + Tags = { }, + Properties = new SchemaRegistryUpdateProperties + { + DisplayName = "Schema Registry namespace 001", + Description = "This is a sample Schema Registry", + }, + }; + ArmOperation lro = await deviceRegistrySchemaRegistry.UpdateAsync(WaitUntil.Completed, patch); + DeviceRegistrySchemaRegistryResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaRegistryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaResource.cs new file mode 100644 index 000000000000..fd03c28f4f12 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaResource.cs @@ -0,0 +1,121 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SchemasGet() + { + // Generated from example definition: 2024-09-01-preview/Get_Schema.json + // this example is just showing the usage of "Schema_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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // invoke the operation + DeviceRegistrySchemaResource result = await deviceRegistrySchema.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 + DeviceRegistrySchemaData 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 Delete_DeleteSchema() + { + // Generated from example definition: 2024-09-01-preview/Delete_Schema.json + // this example is just showing the usage of "Schema_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // invoke the operation + await deviceRegistrySchema.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateSchema() + { + // Generated from example definition: 2024-09-01-preview/Create_Schema.json + // this example is just showing the usage of "Schema_CreateOrReplace" 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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // invoke the operation + DeviceRegistrySchemaData data = new DeviceRegistrySchemaData + { + Properties = new DeviceRegistrySchemaProperties(DeviceRegistrySchemaFormat.JsonSchemaDraft7, DeviceRegistrySchemaType.MessageSchema) + { + DisplayName = "My Schema", + Description = "This is a sample Schema", + Tags = +{ +["sampleKey"] = "sampleValue" +}, + }, + }; + ArmOperation lro = await deviceRegistrySchema.UpdateAsync(WaitUntil.Completed, data); + DeviceRegistrySchemaResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionCollection.cs new file mode 100644 index 000000000000..ea11239dc0a7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionCollection.cs @@ -0,0 +1,208 @@ +// 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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaVersionCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Create_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_CreateOrReplace" 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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // get the collection of this DeviceRegistrySchemaVersionResource + DeviceRegistrySchemaVersionCollection collection = deviceRegistrySchema.GetDeviceRegistrySchemaVersions(); + + // invoke the operation + string schemaVersionName = "1"; + DeviceRegistrySchemaVersionData data = new DeviceRegistrySchemaVersionData + { + Properties = new DeviceRegistrySchemaVersionProperties("{\"$schema\": \"http://json-schema.org/draft-07/schema#\",\"type\": \"object\",\"properties\": {\"humidity\": {\"type\": \"string\"},\"temperature\": {\"type\":\"number\"}}}") + { + Description = "Schema version 1", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaVersionName, data); + DeviceRegistrySchemaVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaVersionData 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 Get_GetSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // get the collection of this DeviceRegistrySchemaVersionResource + DeviceRegistrySchemaVersionCollection collection = deviceRegistrySchema.GetDeviceRegistrySchemaVersions(); + + // invoke the operation + string schemaVersionName = "1"; + DeviceRegistrySchemaVersionResource result = await collection.GetAsync(schemaVersionName); + + // 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 + DeviceRegistrySchemaVersionData 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 GetAll_ListSchemaVersionsSchema() + { + // Generated from example definition: 2024-09-01-preview/List_SchemaVersions_Schema.json + // this example is just showing the usage of "SchemaVersion_ListBySchema" 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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // get the collection of this DeviceRegistrySchemaVersionResource + DeviceRegistrySchemaVersionCollection collection = deviceRegistrySchema.GetDeviceRegistrySchemaVersions(); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistrySchemaVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // get the collection of this DeviceRegistrySchemaVersionResource + DeviceRegistrySchemaVersionCollection collection = deviceRegistrySchema.GetDeviceRegistrySchemaVersions(); + + // invoke the operation + string schemaVersionName = "1"; + bool result = await collection.ExistsAsync(schemaVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_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 DeviceRegistrySchemaResource created on azure + // for more information of creating DeviceRegistrySchemaResource, please refer to the document of DeviceRegistrySchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + ResourceIdentifier deviceRegistrySchemaResourceId = DeviceRegistrySchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + DeviceRegistrySchemaResource deviceRegistrySchema = client.GetDeviceRegistrySchemaResource(deviceRegistrySchemaResourceId); + + // get the collection of this DeviceRegistrySchemaVersionResource + DeviceRegistrySchemaVersionCollection collection = deviceRegistrySchema.GetDeviceRegistrySchemaVersions(); + + // invoke the operation + string schemaVersionName = "1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaVersionName); + DeviceRegistrySchemaVersionResource 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 + DeviceRegistrySchemaVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionResource.cs new file mode 100644 index 000000000000..281841d6b332 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_DeviceRegistrySchemaVersionResource.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.DeviceRegistry.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DeviceRegistry.Samples +{ + public partial class Sample_DeviceRegistrySchemaVersionResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Get_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_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 DeviceRegistrySchemaVersionResource created on azure + // for more information of creating DeviceRegistrySchemaVersionResource, please refer to the document of DeviceRegistrySchemaVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + string schemaVersionName = "1"; + ResourceIdentifier deviceRegistrySchemaVersionResourceId = DeviceRegistrySchemaVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + DeviceRegistrySchemaVersionResource deviceRegistrySchemaVersion = client.GetDeviceRegistrySchemaVersionResource(deviceRegistrySchemaVersionResourceId); + + // invoke the operation + DeviceRegistrySchemaVersionResource result = await deviceRegistrySchemaVersion.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 + DeviceRegistrySchemaVersionData 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 Delete_DeleteSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Delete_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DeviceRegistrySchemaVersionResource created on azure + // for more information of creating DeviceRegistrySchemaVersionResource, please refer to the document of DeviceRegistrySchemaVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + string schemaVersionName = "1"; + ResourceIdentifier deviceRegistrySchemaVersionResourceId = DeviceRegistrySchemaVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + DeviceRegistrySchemaVersionResource deviceRegistrySchemaVersion = client.GetDeviceRegistrySchemaVersionResource(deviceRegistrySchemaVersionResourceId); + + // invoke the operation + await deviceRegistrySchemaVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateSchemaVersion() + { + // Generated from example definition: 2024-09-01-preview/Create_SchemaVersion.json + // this example is just showing the usage of "SchemaVersion_CreateOrReplace" 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 DeviceRegistrySchemaVersionResource created on azure + // for more information of creating DeviceRegistrySchemaVersionResource, please refer to the document of DeviceRegistrySchemaVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string schemaRegistryName = "my-schema-registry"; + string schemaName = "my-schema"; + string schemaVersionName = "1"; + ResourceIdentifier deviceRegistrySchemaVersionResourceId = DeviceRegistrySchemaVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + DeviceRegistrySchemaVersionResource deviceRegistrySchemaVersion = client.GetDeviceRegistrySchemaVersionResource(deviceRegistrySchemaVersionResourceId); + + // invoke the operation + DeviceRegistrySchemaVersionData data = new DeviceRegistrySchemaVersionData + { + Properties = new DeviceRegistrySchemaVersionProperties("{\"$schema\": \"http://json-schema.org/draft-07/schema#\",\"type\": \"object\",\"properties\": {\"humidity\": {\"type\": \"string\"},\"temperature\": {\"type\":\"number\"}}}") + { + Description = "Schema version 1", + }, + }; + ArmOperation lro = await deviceRegistrySchemaVersion.UpdateAsync(WaitUntil.Completed, data); + DeviceRegistrySchemaVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index ea2b8e92496c..3dc49dd86e3a 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -18,10 +18,41 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetDeviceRegistryAssetEndpointProfiles_ListAssetEndpointProfilesInASubscription() + public async Task GetDeviceRegistryAssets_ListAssetsSubscription() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json - // this example is just showing the usage of "AssetEndpointProfiles_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/List_Assets_Subscription.json + // this example is just showing the usage of "Asset_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistryAssetResource item in subscriptionResource.GetDeviceRegistryAssetsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryAssetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDeviceRegistryAssetEndpointProfiles_ListAssetEndpointProfilesSubscription() + { + // Generated from example definition: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json + // this example is just showing the usage of "AssetEndpointProfile_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -49,10 +80,10 @@ public async Task GetDeviceRegistryAssetEndpointProfiles_ListAssetEndpointProfil [Test] [Ignore("Only validating compilation of examples")] - public async Task GetDeviceRegistryAssets_ListAssetsInASubscription() + public async Task GetDeviceRegistryDiscoveredAssets_ListDiscoveredAssetsSubscription() { - // Generated from example definition: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json - // this example is just showing the usage of "Assets_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + // this example is just showing the usage of "DiscoveredAsset_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -66,11 +97,73 @@ public async Task GetDeviceRegistryAssets_ListAssetsInASubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (DeviceRegistryAssetResource item in subscriptionResource.GetDeviceRegistryAssetsAsync()) + await foreach (DeviceRegistryDiscoveredAssetResource item in subscriptionResource.GetDeviceRegistryDiscoveredAssetsAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - DeviceRegistryAssetData resourceData = item.Data; + DeviceRegistryDiscoveredAssetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDeviceRegistryDiscoveredAssetEndpointProfiles_ListDiscoveredAssetEndpointProfilesSubscription() + { + // Generated from example definition: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + // this example is just showing the usage of "DiscoveredAssetEndpointProfile_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistryDiscoveredAssetEndpointProfileResource item in subscriptionResource.GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistryDiscoveredAssetEndpointProfileData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDeviceRegistrySchemaRegistries_ListSchemaRegistriesSubscription() + { + // Generated from example definition: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + // this example is just showing the usage of "SchemaRegistry_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DeviceRegistrySchemaRegistryResource item in subscriptionResource.GetDeviceRegistrySchemaRegistriesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DeviceRegistrySchemaRegistryData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/ArmDeviceRegistryModelFactory.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/ArmDeviceRegistryModelFactory.cs index 582a5f5a9e7d..d90426b2570c 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/ArmDeviceRegistryModelFactory.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/ArmDeviceRegistryModelFactory.cs @@ -16,25 +16,284 @@ namespace Azure.ResourceManager.DeviceRegistry.Models /// Model factory for models. public static partial class ArmDeviceRegistryModelFactory { - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DeviceRegistrySchemaVersionData DeviceRegistrySchemaVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeviceRegistrySchemaVersionProperties properties = null) + { + return new DeviceRegistrySchemaVersionData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Human-readable description of the schema. + /// Schema content. + /// Hash of the schema content. + /// Provisioning state of the resource. + /// A new instance for mocking. + public static DeviceRegistrySchemaVersionProperties DeviceRegistrySchemaVersionProperties(string uuid = null, string description = null, string schemaContent = null, string hash = null, DeviceRegistryProvisioningState? provisioningState = null) + { + return new DeviceRegistrySchemaVersionProperties( + uuid, + description, + schemaContent, + hash, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DeviceRegistrySchemaData DeviceRegistrySchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeviceRegistrySchemaProperties properties = null) + { + return new DeviceRegistrySchemaData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Human-readable display name. + /// Human-readable description of the schema. + /// Format of the schema. + /// Type of the schema. + /// Provisioning state of the resource. + /// Schema tags. + /// A new instance for mocking. + public static DeviceRegistrySchemaProperties DeviceRegistrySchemaProperties(string uuid = null, string displayName = null, string description = null, DeviceRegistrySchemaFormat format = default, DeviceRegistrySchemaType schemaType = default, DeviceRegistryProvisioningState? provisioningState = null, IDictionary tags = null) + { + tags ??= new Dictionary(); + + return new DeviceRegistrySchemaProperties( + uuid, + displayName, + description, + format, + schemaType, + provisioningState, + tags, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The extended location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// A new instance for mocking. + public static DeviceRegistrySchemaRegistryData DeviceRegistrySchemaRegistryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DeviceRegistrySchemaRegistryProperties properties = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new DeviceRegistrySchemaRegistryData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// Globally unique, immutable, non-reusable id. + /// Schema registry namespace. Uniquely identifies a schema registry within a tenant. + /// Human-readable display name. + /// Human-readable description of the schema registry. + /// The Storage Account's Container URL where schemas will be stored. + /// Provisioning state of the resource. + /// A new instance for mocking. + public static DeviceRegistrySchemaRegistryProperties DeviceRegistrySchemaRegistryProperties(string uuid = null, string @namespace = null, string displayName = null, string description = null, Uri storageAccountContainerUri = null, DeviceRegistryProvisioningState? provisioningState = null) + { + return new DeviceRegistrySchemaRegistryProperties( + uuid, + @namespace, + displayName, + description, + storageAccountContainerUri, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The extended location. + /// A new instance for mocking. + public static DeviceRegistryDiscoveredAssetEndpointProfileData DeviceRegistryDiscoveredAssetEndpointProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DiscoveredAssetEndpointProfileProperties properties = null, DeviceRegistryExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new DeviceRegistryDiscoveredAssetEndpointProfileData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. - /// Defines the client authentication mechanism to the server. - /// Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - /// Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// List of supported authentication methods supported by the target server. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Identifier used to detect changes in the asset endpoint profile. + /// An integer that is incremented each time the resource is modified. + /// Provisioning state of the resource. + /// A new instance for mocking. + public static DiscoveredAssetEndpointProfileProperties DiscoveredAssetEndpointProfileProperties(Uri targetAddress = null, string additionalConfiguration = null, IEnumerable supportedAuthenticationMethods = null, string endpointProfileType = null, string discoveryId = null, long version = default, DeviceRegistryProvisioningState? provisioningState = null) + { + supportedAuthenticationMethods ??= new List(); + + return new DiscoveredAssetEndpointProfileProperties( + targetAddress, + additionalConfiguration, + supportedAuthenticationMethods?.ToList(), + endpointProfileType, + discoveryId, + version, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The extended location. + /// A new instance for mocking. + public static DeviceRegistryDiscoveredAssetData DeviceRegistryDiscoveredAssetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DeviceRegistryDiscoveredAssetProperties properties = null, DeviceRegistryExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new DeviceRegistryDiscoveredAssetData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + /// Identifier used to detect changes in the asset. + /// An integer that is incremented each time the resource is modified. + /// Asset manufacturer name. + /// Asset manufacturer URI. + /// Asset model name. + /// Asset product code. + /// Revision number of the hardware. + /// Revision number of the software. + /// Reference to the documentation. + /// Asset serial number. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. /// Provisioning state of the resource. + /// A new instance for mocking. + public static DeviceRegistryDiscoveredAssetProperties DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef = null, string discoveryId = null, long version = default, string manufacturer = null, Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, Uri documentationUri = null, string serialNumber = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, DeviceRegistryTopic defaultTopic = null, IEnumerable datasets = null, IEnumerable events = null, DeviceRegistryProvisioningState? provisioningState = null) + { + datasets ??= new List(); + events ??= new List(); + + return new DeviceRegistryDiscoveredAssetProperties( + assetEndpointProfileRef, + discoveryId, + version, + manufacturer, + manufacturerUri, + model, + productCode, + hardwareRevision, + softwareRevision, + documentationUri, + serialNumber, + defaultDatasetsConfiguration, + defaultEventsConfiguration, + defaultTopic, + datasets?.ToList(), + events?.ToList(), + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Resource ETag. + /// A new instance for mocking. + public static DeviceRegistryBillingContainerData DeviceRegistryBillingContainerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeviceRegistryProvisioningState? billingContainerProvisioningState = null, ETag? etag = null) + { + return new DeviceRegistryBillingContainerData( + id, + name, + resourceType, + systemData, + billingContainerProvisioningState != null ? new BillingContainerProperties(billingContainerProvisioningState, serializedAdditionalRawData: null) : null, + etag, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The extended location. /// A new instance for mocking. - public static DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, Uri targetAddress = null, UserAuthentication userAuthentication = null, IEnumerable transportAuthenticationOwnCertificates = null, string additionalConfiguration = null, DeviceRegistryProvisioningState? provisioningState = null) + public static DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpointProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DeviceRegistryAssetEndpointProfileProperties properties = null, DeviceRegistryExtendedLocation extendedLocation = null) { tags ??= new Dictionary(); - transportAuthenticationOwnCertificates ??= new List(); return new DeviceRegistryAssetEndpointProfileData( id, @@ -43,16 +302,46 @@ public static DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpoint systemData, tags, location, + properties, extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Defines the client authentication mechanism to the server. + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// Reference to a discovered asset endpoint profile. Populated only if the asset endpoint profile has been created from discovery flow. Discovered asset endpoint profile name must be provided. + /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. + /// Provisioning state of the resource. + /// A new instance for mocking. + public static DeviceRegistryAssetEndpointProfileProperties DeviceRegistryAssetEndpointProfileProperties(string uuid = null, Uri targetAddress = null, string endpointProfileType = null, DeviceRegistryAuthentication authentication = null, string additionalConfiguration = null, string discoveredAssetEndpointProfileRef = null, IEnumerable statusErrors = null, DeviceRegistryProvisioningState? provisioningState = null) + { + statusErrors ??= new List(); + + return new DeviceRegistryAssetEndpointProfileProperties( uuid, targetAddress, - userAuthentication, - transportAuthenticationOwnCertificates != null ? new TransportAuthentication(transportAuthenticationOwnCertificates?.ToList(), serializedAdditionalRawData: null) : null, + endpointProfileType, + authentication, additionalConfiguration, + discoveredAssetEndpointProfileRef, + statusErrors != null ? new AssetEndpointProfileStatus(statusErrors?.ToList(), serializedAdditionalRawData: null) : null, provisioningState, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Error code for classification of errors (ex: 400, 404, 500, etc.). + /// Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not a valid url”). + /// A new instance for mocking. + public static AssetEndpointProfileStatusError AssetEndpointProfileStatusError(int? code = null, string message = null) + { + return new AssetEndpointProfileStatusError(code, message, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -60,14 +349,32 @@ public static DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpoint /// The systemData. /// The tags. /// The location. + /// The resource-specific properties for this resource. /// The extended location. + /// A new instance for mocking. + public static DeviceRegistryAssetData DeviceRegistryAssetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AssetProperties properties = null, DeviceRegistryExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new DeviceRegistryAssetData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// Globally unique, immutable, non-reusable id. - /// Resource path to asset type (model) definition. - /// Enabled/Disabled status of the asset. + /// Enabled/Disabled status of the asset. /// Asset id provided by the customer. /// Human-readable display name. /// Human-readable description of the asset. - /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. /// An integer that is incremented each time the resource is modified. /// Asset manufacturer name. /// Asset manufacturer URI. @@ -78,35 +385,29 @@ public static DeviceRegistryAssetEndpointProfileData DeviceRegistryAssetEndpoint /// Reference to the documentation. /// Asset serial number. /// A set of key-value pairs that contain custom attributes set by the customer. - /// Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. - /// Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. + /// Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered asset names must be provided. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. /// Provisioning state of the resource. - /// A new instance for mocking. - public static DeviceRegistryAssetData DeviceRegistryAssetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DeviceRegistryExtendedLocation extendedLocation = null, string uuid = null, string assetType = null, bool? enabled = null, string externalAssetId = null, string displayName = null, string description = null, Uri assetEndpointProfileUri = null, int? version = null, string manufacturer = null, Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, Uri documentationUri = null, string serialNumber = null, IDictionary attributes = null, string defaultDataPointsConfiguration = null, string defaultEventsConfiguration = null, IEnumerable dataPoints = null, IEnumerable events = null, AssetStatus status = null, DeviceRegistryProvisioningState? provisioningState = null) + /// A new instance for mocking. + public static AssetProperties AssetProperties(string uuid = null, bool? isEnabled = null, string externalAssetId = null, string displayName = null, string description = null, string assetEndpointProfileRef = null, long? version = null, string manufacturer = null, Uri manufacturerUri = null, string model = null, string productCode = null, string hardwareRevision = null, string softwareRevision = null, Uri documentationUri = null, string serialNumber = null, IDictionary attributes = null, IEnumerable discoveredAssetRefs = null, string defaultDatasetsConfiguration = null, string defaultEventsConfiguration = null, DeviceRegistryTopic defaultTopic = null, IEnumerable datasets = null, IEnumerable events = null, DeviceRegistryAssetStatus status = null, DeviceRegistryProvisioningState? provisioningState = null) { - tags ??= new Dictionary(); attributes ??= new Dictionary(); - dataPoints ??= new List(); - events ??= new List(); + discoveredAssetRefs ??= new List(); + datasets ??= new List(); + events ??= new List(); - return new DeviceRegistryAssetData( - id, - name, - resourceType, - systemData, - tags, - location, - extendedLocation, + return new AssetProperties( uuid, - assetType, - enabled, + isEnabled, externalAssetId, displayName, description, - assetEndpointProfileUri, + assetEndpointProfileRef, version, manufacturer, manufacturerUri, @@ -117,33 +418,67 @@ public static DeviceRegistryAssetData DeviceRegistryAssetData(ResourceIdentifier documentationUri, serialNumber, attributes, - defaultDataPointsConfiguration, + discoveredAssetRefs?.ToList(), + defaultDatasetsConfiguration, defaultEventsConfiguration, - dataPoints?.ToList(), + defaultTopic, + datasets?.ToList(), events?.ToList(), status, provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Array object to transfer and persist errors that originate from the Edge. /// A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. - /// A new instance for mocking. - public static AssetStatus AssetStatus(IEnumerable errors = null, int? version = null) + /// Array of dataset statuses that describe the status of each dataset. + /// Array of event statuses that describe the status of each event. + /// A new instance for mocking. + public static DeviceRegistryAssetStatus DeviceRegistryAssetStatus(IEnumerable errors = null, long? version = null, IEnumerable datasets = null, IEnumerable events = null) { - errors ??= new List(); + errors ??= new List(); + datasets ??= new List(); + events ??= new List(); - return new AssetStatus(errors?.ToList(), version, serializedAdditionalRawData: null); + return new DeviceRegistryAssetStatus(errors?.ToList(), version, datasets?.ToList(), events?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Error code for classification of errors (ex: 400, 404, 500, etc.). /// Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). - /// A new instance for mocking. - public static AssetStatusError AssetStatusError(int? code = null, string message = null) + /// A new instance for mocking. + public static DeviceRegistryAssetStatusError DeviceRegistryAssetStatusError(int? code = null, string message = null) + { + return new DeviceRegistryAssetStatusError(code, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. + /// The message schema reference object. + /// A new instance for mocking. + public static DeviceRegistryAssetStatusDataset DeviceRegistryAssetStatusDataset(string name = null, MessageSchemaReference messageSchemaReference = null) + { + return new DeviceRegistryAssetStatusDataset(name, messageSchemaReference, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The message schema registry namespace. + /// The message schema name. + /// The message schema version. + /// A new instance for mocking. + public static MessageSchemaReference MessageSchemaReference(string schemaRegistryNamespace = null, string schemaName = null, string schemaVersion = null) + { + return new MessageSchemaReference(schemaRegistryNamespace, schemaName, schemaVersion, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. + /// The message schema reference object. + /// A new instance for mocking. + public static DeviceRegistryAssetStatusEvent DeviceRegistryAssetStatusEvent(string name = null, MessageSchemaReference messageSchemaReference = null) { - return new AssetStatusError(code, message, serializedAdditionalRawData: null); + return new DeviceRegistryAssetStatusEvent(name, messageSchemaReference, serializedAdditionalRawData: null); } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetCollection.cs index 35bb4e2c71c2..b3772dc0f191 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetCollection.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetCollection.cs @@ -61,11 +61,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Assets_CreateOrReplace + /// Asset_CreateOrReplace /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -110,11 +110,11 @@ public virtual async Task> CreateOrUpd /// /// /// Operation Id - /// Assets_CreateOrReplace + /// Asset_CreateOrReplace /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -159,11 +159,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUnti /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -204,11 +204,11 @@ public virtual async Task> GetAsync(string /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -249,11 +249,11 @@ public virtual Response Get(string assetName, Cance /// /// /// Operation Id - /// Assets_ListByResourceGroup + /// Asset_ListByResourceGroup /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -279,11 +279,11 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// /// /// Operation Id - /// Assets_ListByResourceGroup + /// Asset_ListByResourceGroup /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -309,11 +309,11 @@ public virtual Pageable GetAll(CancellationToken ca /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -352,11 +352,11 @@ public virtual async Task> ExistsAsync(string assetName, Cancella /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -395,11 +395,11 @@ public virtual Response Exists(string assetName, CancellationToken cancell /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -440,11 +440,11 @@ public virtual async Task> GetIfEx /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.Serialization.cs index 8093ed4b75f9..c97b822f3eaf 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.Serialization.cs @@ -37,154 +37,13 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("extendedLocation"u8); - writer.WriteObjectValue(ExtendedLocation, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(Uuid)) - { - writer.WritePropertyName("uuid"u8); - writer.WriteStringValue(Uuid); - } - if (Optional.IsDefined(AssetType)) - { - writer.WritePropertyName("assetType"u8); - writer.WriteStringValue(AssetType); - } - if (Optional.IsDefined(Enabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(Enabled.Value); - } - if (Optional.IsDefined(ExternalAssetId)) - { - writer.WritePropertyName("externalAssetId"u8); - writer.WriteStringValue(ExternalAssetId); - } - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(AssetEndpointProfileUri)) - { - writer.WritePropertyName("assetEndpointProfileUri"u8); - writer.WriteStringValue(AssetEndpointProfileUri.AbsoluteUri); - } - if (options.Format != "W" && Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - if (Optional.IsDefined(Manufacturer)) - { - writer.WritePropertyName("manufacturer"u8); - writer.WriteStringValue(Manufacturer); - } - if (Optional.IsDefined(ManufacturerUri)) - { - writer.WritePropertyName("manufacturerUri"u8); - writer.WriteStringValue(ManufacturerUri.AbsoluteUri); - } - if (Optional.IsDefined(Model)) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - } - if (Optional.IsDefined(ProductCode)) - { - writer.WritePropertyName("productCode"u8); - writer.WriteStringValue(ProductCode); - } - if (Optional.IsDefined(HardwareRevision)) - { - writer.WritePropertyName("hardwareRevision"u8); - writer.WriteStringValue(HardwareRevision); - } - if (Optional.IsDefined(SoftwareRevision)) - { - writer.WritePropertyName("softwareRevision"u8); - writer.WriteStringValue(SoftwareRevision); - } - if (Optional.IsDefined(DocumentationUri)) - { - writer.WritePropertyName("documentationUri"u8); - writer.WriteStringValue(DocumentationUri.AbsoluteUri); - } - if (Optional.IsDefined(SerialNumber)) - { - writer.WritePropertyName("serialNumber"u8); - writer.WriteStringValue(SerialNumber); - } - if (Optional.IsCollectionDefined(Attributes)) - { - writer.WritePropertyName("attributes"u8); - writer.WriteStartObject(); - foreach (var item in Attributes) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(DefaultDataPointsConfiguration)) - { - writer.WritePropertyName("defaultDataPointsConfiguration"u8); - writer.WriteStringValue(DefaultDataPointsConfiguration); - } - if (Optional.IsDefined(DefaultEventsConfiguration)) - { - writer.WritePropertyName("defaultEventsConfiguration"u8); - writer.WriteStringValue(DefaultEventsConfiguration); - } - if (Optional.IsCollectionDefined(DataPoints)) - { - writer.WritePropertyName("dataPoints"u8); - writer.WriteStartArray(); - foreach (var item in DataPoints) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(Events)) - { - writer.WritePropertyName("events"u8); - writer.WriteStartArray(); - foreach (var item in Events) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteObjectValue(Status, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); } DeviceRegistryAssetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -207,6 +66,7 @@ internal static DeviceRegistryAssetData DeserializeDeviceRegistryAssetData(JsonE { return null; } + AssetProperties properties = default; DeviceRegistryExtendedLocation extendedLocation = default; IDictionary tags = default; AzureLocation location = default; @@ -214,33 +74,19 @@ internal static DeviceRegistryAssetData DeserializeDeviceRegistryAssetData(JsonE string name = default; ResourceType type = default; SystemData systemData = default; - string uuid = default; - string assetType = default; - bool? enabled = default; - string externalAssetId = default; - string displayName = default; - string description = default; - Uri assetEndpointProfileUri = default; - int? version = default; - string manufacturer = default; - Uri manufacturerUri = default; - string model = default; - string productCode = default; - string hardwareRevision = default; - string softwareRevision = default; - Uri documentationUri = default; - string serialNumber = default; - IDictionary attributes = default; - string defaultDataPointsConfiguration = default; - string defaultEventsConfiguration = default; - IList dataPoints = default; - IList events = default; - AssetStatus status = default; - DeviceRegistryProvisioningState? provisioningState = 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 = AssetProperties.DeserializeAssetProperties(property.Value, options); + continue; + } if (property.NameEquals("extendedLocation"u8)) { extendedLocation = DeviceRegistryExtendedLocation.DeserializeDeviceRegistryExtendedLocation(property.Value, options); @@ -289,195 +135,6 @@ internal static DeviceRegistryAssetData DeserializeDeviceRegistryAssetData(JsonE systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("uuid"u8)) - { - uuid = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("assetType"u8)) - { - assetType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("externalAssetId"u8)) - { - externalAssetId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("assetEndpointProfileUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - assetEndpointProfileUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("version"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("manufacturer"u8)) - { - manufacturer = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("manufacturerUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - manufacturerUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("model"u8)) - { - model = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productCode"u8)) - { - productCode = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("hardwareRevision"u8)) - { - hardwareRevision = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("softwareRevision"u8)) - { - softwareRevision = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("documentationUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - documentationUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("serialNumber"u8)) - { - serialNumber = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("attributes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - if (property1.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property1.Name, null); - } - else - { - dictionary.Add(property1.Name, BinaryData.FromString(property1.Value.GetRawText())); - } - } - attributes = dictionary; - continue; - } - if (property0.NameEquals("defaultDataPointsConfiguration"u8)) - { - defaultDataPointsConfiguration = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("defaultEventsConfiguration"u8)) - { - defaultEventsConfiguration = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataPoints"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DataPoint.DeserializeDataPoint(item, options)); - } - dataPoints = array; - continue; - } - if (property0.NameEquals("events"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AssetEvent.DeserializeAssetEvent(item, options)); - } - events = array; - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = AssetStatus.DeserializeAssetStatus(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new DeviceRegistryProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -491,30 +148,8 @@ internal static DeviceRegistryAssetData DeserializeDeviceRegistryAssetData(JsonE systemData, tags ?? new ChangeTrackingDictionary(), location, + properties, extendedLocation, - uuid, - assetType, - enabled, - externalAssetId, - displayName, - description, - assetEndpointProfileUri, - version, - manufacturer, - manufacturerUri, - model, - productCode, - hardwareRevision, - softwareRevision, - documentationUri, - serialNumber, - attributes ?? new ChangeTrackingDictionary(), - defaultDataPointsConfiguration, - defaultEventsConfiguration, - dataPoints ?? new ChangeTrackingList(), - events ?? new ChangeTrackingList(), - status, - provisioningState, serializedAdditionalRawData); } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.cs index 607dda4f4510..3b9ea25a8bc4 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetData.cs @@ -60,9 +60,6 @@ public DeviceRegistryAssetData(AzureLocation location, DeviceRegistryExtendedLoc Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); ExtendedLocation = extendedLocation; - Attributes = new ChangeTrackingDictionary(); - DataPoints = new ChangeTrackingList(); - Events = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -72,57 +69,13 @@ public DeviceRegistryAssetData(AzureLocation location, DeviceRegistryExtendedLoc /// The systemData. /// The tags. /// The location. + /// The resource-specific properties for this resource. /// The extended location. - /// Globally unique, immutable, non-reusable id. - /// Resource path to asset type (model) definition. - /// Enabled/Disabled status of the asset. - /// Asset id provided by the customer. - /// Human-readable display name. - /// Human-readable description of the asset. - /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. - /// An integer that is incremented each time the resource is modified. - /// Asset manufacturer name. - /// Asset manufacturer URI. - /// Asset model name. - /// Asset product code. - /// Revision number of the hardware. - /// Revision number of the software. - /// Reference to the documentation. - /// Asset serial number. - /// A set of key-value pairs that contain custom attributes set by the customer. - /// Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. - /// Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. - /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. - /// Provisioning state of the resource. /// Keeps track of any properties unknown to the library. - internal DeviceRegistryAssetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DeviceRegistryExtendedLocation extendedLocation, string uuid, string assetType, bool? enabled, string externalAssetId, string displayName, string description, Uri assetEndpointProfileUri, int? version, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, IDictionary attributes, string defaultDataPointsConfiguration, string defaultEventsConfiguration, IList dataPoints, IList events, AssetStatus status, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal DeviceRegistryAssetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AssetProperties properties, DeviceRegistryExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Properties = properties; ExtendedLocation = extendedLocation; - Uuid = uuid; - AssetType = assetType; - Enabled = enabled; - ExternalAssetId = externalAssetId; - DisplayName = displayName; - Description = description; - AssetEndpointProfileUri = assetEndpointProfileUri; - Version = version; - Manufacturer = manufacturer; - ManufacturerUri = manufacturerUri; - Model = model; - ProductCode = productCode; - HardwareRevision = hardwareRevision; - SoftwareRevision = softwareRevision; - DocumentationUri = documentationUri; - SerialNumber = serialNumber; - Attributes = attributes; - DefaultDataPointsConfiguration = defaultDataPointsConfiguration; - DefaultEventsConfiguration = defaultEventsConfiguration; - DataPoints = dataPoints; - Events = events; - Status = status; - ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -131,82 +84,9 @@ internal DeviceRegistryAssetData() { } + /// The resource-specific properties for this resource. + public AssetProperties Properties { get; set; } /// The extended location. public DeviceRegistryExtendedLocation ExtendedLocation { get; set; } - /// Globally unique, immutable, non-reusable id. - public string Uuid { get; } - /// Resource path to asset type (model) definition. - public string AssetType { get; set; } - /// Enabled/Disabled status of the asset. - public bool? Enabled { get; set; } - /// Asset id provided by the customer. - public string ExternalAssetId { get; set; } - /// Human-readable display name. - public string DisplayName { get; set; } - /// Human-readable description of the asset. - public string Description { get; set; } - /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. - public Uri AssetEndpointProfileUri { get; set; } - /// An integer that is incremented each time the resource is modified. - public int? Version { get; } - /// Asset manufacturer name. - public string Manufacturer { get; set; } - /// Asset manufacturer URI. - public Uri ManufacturerUri { get; set; } - /// Asset model name. - public string Model { get; set; } - /// Asset product code. - public string ProductCode { get; set; } - /// Revision number of the hardware. - public string HardwareRevision { get; set; } - /// Revision number of the software. - public string SoftwareRevision { get; set; } - /// Reference to the documentation. - public Uri DocumentationUri { get; set; } - /// Asset serial number. - public string SerialNumber { get; set; } - /// - /// A set of key-value pairs that contain custom attributes set by the customer. - /// - /// 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" }. - /// - /// - /// - /// - public IDictionary Attributes { get; } - /// Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - public string DefaultDataPointsConfiguration { get; set; } - /// Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - public string DefaultEventsConfiguration { get; set; } - /// Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. - public IList DataPoints { get; } - /// Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. - public IList Events { get; } - /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. - public AssetStatus Status { get; } - /// Provisioning state of the resource. - public DeviceRegistryProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileCollection.cs index 78d412231ac9..177901e6383c 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileCollection.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileCollection.cs @@ -61,11 +61,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AssetEndpointProfiles_CreateOrReplace + /// AssetEndpointProfile_CreateOrReplace /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -110,11 +110,11 @@ public virtual async Task /// /// Operation Id - /// AssetEndpointProfiles_CreateOrReplace + /// AssetEndpointProfile_CreateOrReplace /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -159,11 +159,11 @@ public virtual ArmOperation CreateOr /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -204,11 +204,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -249,11 +249,11 @@ public virtual Response Get(string a /// /// /// Operation Id - /// AssetEndpointProfiles_ListByResourceGroup + /// AssetEndpointProfile_ListByResourceGroup /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -279,11 +279,11 @@ public virtual AsyncPageable GetAllA /// /// /// Operation Id - /// AssetEndpointProfiles_ListByResourceGroup + /// AssetEndpointProfile_ListByResourceGroup /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -309,11 +309,11 @@ public virtual Pageable GetAll(Cance /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -352,11 +352,11 @@ public virtual async Task> ExistsAsync(string assetEndpointProfil /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -395,11 +395,11 @@ public virtual Response Exists(string assetEndpointProfileName, Cancellati /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -440,11 +440,11 @@ public virtual async Task /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.Serialization.cs index 6a49397fb3a4..1472ed184c6a 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.Serialization.cs @@ -37,41 +37,13 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("extendedLocation"u8); - writer.WriteObjectValue(ExtendedLocation, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(Uuid)) - { - writer.WritePropertyName("uuid"u8); - writer.WriteStringValue(Uuid); - } - if (Optional.IsDefined(TargetAddress)) - { - writer.WritePropertyName("targetAddress"u8); - writer.WriteStringValue(TargetAddress.AbsoluteUri); - } - if (Optional.IsDefined(UserAuthentication)) - { - writer.WritePropertyName("userAuthentication"u8); - writer.WriteObjectValue(UserAuthentication, options); - } - if (Optional.IsDefined(TransportAuthentication)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("transportAuthentication"u8); - writer.WriteObjectValue(TransportAuthentication, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(AdditionalConfiguration)) - { - writer.WritePropertyName("additionalConfiguration"u8); - writer.WriteStringValue(AdditionalConfiguration); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); } DeviceRegistryAssetEndpointProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -94,6 +66,7 @@ internal static DeviceRegistryAssetEndpointProfileData DeserializeDeviceRegistry { return null; } + DeviceRegistryAssetEndpointProfileProperties properties = default; DeviceRegistryExtendedLocation extendedLocation = default; IDictionary tags = default; AzureLocation location = default; @@ -101,16 +74,19 @@ internal static DeviceRegistryAssetEndpointProfileData DeserializeDeviceRegistry string name = default; ResourceType type = default; SystemData systemData = default; - string uuid = default; - Uri targetAddress = default; - UserAuthentication userAuthentication = default; - TransportAuthentication transportAuthentication = default; - string additionalConfiguration = default; - DeviceRegistryProvisioningState? provisioningState = 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 = DeviceRegistryAssetEndpointProfileProperties.DeserializeDeviceRegistryAssetEndpointProfileProperties(property.Value, options); + continue; + } if (property.NameEquals("extendedLocation"u8)) { extendedLocation = DeviceRegistryExtendedLocation.DeserializeDeviceRegistryExtendedLocation(property.Value, options); @@ -159,64 +135,6 @@ internal static DeviceRegistryAssetEndpointProfileData DeserializeDeviceRegistry systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("uuid"u8)) - { - uuid = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("targetAddress"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - targetAddress = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("userAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - userAuthentication = UserAuthentication.DeserializeUserAuthentication(property0.Value, options); - continue; - } - if (property0.NameEquals("transportAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - transportAuthentication = TransportAuthentication.DeserializeTransportAuthentication(property0.Value, options); - continue; - } - if (property0.NameEquals("additionalConfiguration"u8)) - { - additionalConfiguration = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new DeviceRegistryProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -230,13 +148,8 @@ internal static DeviceRegistryAssetEndpointProfileData DeserializeDeviceRegistry systemData, tags ?? new ChangeTrackingDictionary(), location, + properties, extendedLocation, - uuid, - targetAddress, - userAuthentication, - transportAuthentication, - additionalConfiguration, - provisioningState, serializedAdditionalRawData); } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.cs index 1b39741a3e1f..38deb6904df4 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileData.cs @@ -69,23 +69,13 @@ public DeviceRegistryAssetEndpointProfileData(AzureLocation location, DeviceRegi /// The systemData. /// The tags. /// The location. + /// The resource-specific properties for this resource. /// The extended location. - /// Globally unique, immutable, non-reusable id. - /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. - /// Defines the client authentication mechanism to the server. - /// Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - /// Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). - /// Provisioning state of the resource. /// Keeps track of any properties unknown to the library. - internal DeviceRegistryAssetEndpointProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DeviceRegistryExtendedLocation extendedLocation, string uuid, Uri targetAddress, UserAuthentication userAuthentication, TransportAuthentication transportAuthentication, string additionalConfiguration, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal DeviceRegistryAssetEndpointProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DeviceRegistryAssetEndpointProfileProperties properties, DeviceRegistryExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Properties = properties; ExtendedLocation = extendedLocation; - Uuid = uuid; - TargetAddress = targetAddress; - UserAuthentication = userAuthentication; - TransportAuthentication = transportAuthentication; - AdditionalConfiguration = additionalConfiguration; - ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -94,26 +84,9 @@ internal DeviceRegistryAssetEndpointProfileData() { } + /// The resource-specific properties for this resource. + public DeviceRegistryAssetEndpointProfileProperties Properties { get; set; } /// The extended location. public DeviceRegistryExtendedLocation ExtendedLocation { get; set; } - /// Globally unique, immutable, non-reusable id. - public string Uuid { get; } - /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. - public Uri TargetAddress { get; set; } - /// Defines the client authentication mechanism to the server. - public UserAuthentication UserAuthentication { get; set; } - /// Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - internal TransportAuthentication TransportAuthentication { get; set; } - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - public IList TransportAuthenticationOwnCertificates - { - get => TransportAuthentication is null ? default : TransportAuthentication.OwnCertificates; - set => TransportAuthentication = new TransportAuthentication(value); - } - - /// Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). - public string AdditionalConfiguration { get; set; } - /// Provisioning state of the resource. - public DeviceRegistryProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileResource.cs index b382c8ec8d2c..ce93bf73a83d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetEndpointProfileResource.cs @@ -99,11 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -139,11 +139,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -179,11 +179,11 @@ public virtual Response Get(Cancella /// /// /// Operation Id - /// AssetEndpointProfiles_Delete + /// AssetEndpointProfile_Delete /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -221,11 +221,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// AssetEndpointProfiles_Delete + /// AssetEndpointProfile_Delete /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -263,11 +263,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// AssetEndpointProfiles_Update + /// AssetEndpointProfile_Update /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -309,11 +309,11 @@ public virtual async Task /// /// Operation Id - /// AssetEndpointProfiles_Update + /// AssetEndpointProfile_Update /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -355,11 +355,11 @@ public virtual ArmOperation Update(W /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -417,11 +417,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -479,11 +479,11 @@ public virtual Response AddTag(strin /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -536,11 +536,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -593,11 +593,11 @@ public virtual Response SetTags(IDic /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -653,11 +653,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetResource.cs index 679917e21f6d..b4c422ebbf56 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryAssetResource.cs @@ -99,11 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -139,11 +139,11 @@ public virtual async Task> GetAsync(Cancel /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -179,11 +179,11 @@ public virtual Response Get(CancellationToken cance /// /// /// Operation Id - /// Assets_Delete + /// Asset_Delete /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -221,11 +221,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Assets_Delete + /// Asset_Delete /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -263,11 +263,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Assets_Update + /// Asset_Update /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -309,11 +309,11 @@ public virtual async Task> UpdateAsync /// /// /// Operation Id - /// Assets_Update + /// Asset_Update /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -355,11 +355,11 @@ public virtual ArmOperation Update(WaitUntil waitUn /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -417,11 +417,11 @@ public virtual async Task> AddTagAsync(str /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -479,11 +479,11 @@ public virtual Response AddTag(string key, string v /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -536,11 +536,11 @@ public virtual async Task> SetTagsAsync(ID /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -593,11 +593,11 @@ public virtual Response SetTags(IDictionary /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -653,11 +653,11 @@ public virtual async Task> RemoveTagAsync( /// /// /// Operation Id - /// Assets_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerCollection.cs new file mode 100644 index 000000000000..c988a875118e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerCollection.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistryBillingContainers method from an instance of . + /// + public partial class DeviceRegistryBillingContainerCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistryBillingContainerBillingContainersClientDiagnostics; + private readonly BillingContainersRestOperations _deviceRegistryBillingContainerBillingContainersRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryBillingContainerCollection() + { + } + + /// 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 DeviceRegistryBillingContainerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryBillingContainerBillingContainersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryBillingContainerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistryBillingContainerResource.ResourceType, out string deviceRegistryBillingContainerBillingContainersApiVersion); + _deviceRegistryBillingContainerBillingContainersRestClient = new BillingContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryBillingContainerBillingContainersApiVersion); +#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)); + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryBillingContainerBillingContainersRestClient.GetAsync(Id.SubscriptionId, billingContainerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistryBillingContainerBillingContainersRestClient.Get(Id.SubscriptionId, billingContainerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BillingContainer resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers + /// + /// + /// Operation Id + /// BillingContainer_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryBillingContainerBillingContainersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryBillingContainerBillingContainersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryBillingContainerResource(Client, DeviceRegistryBillingContainerData.DeserializeDeviceRegistryBillingContainerData(e)), _deviceRegistryBillingContainerBillingContainersClientDiagnostics, Pipeline, "DeviceRegistryBillingContainerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BillingContainer resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers + /// + /// + /// Operation Id + /// BillingContainer_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryBillingContainerBillingContainersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryBillingContainerBillingContainersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryBillingContainerResource(Client, DeviceRegistryBillingContainerData.DeserializeDeviceRegistryBillingContainerData(e)), _deviceRegistryBillingContainerBillingContainersClientDiagnostics, Pipeline, "DeviceRegistryBillingContainerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistryBillingContainerBillingContainersRestClient.GetAsync(Id.SubscriptionId, billingContainerName, 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.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistryBillingContainerBillingContainersRestClient.Get(Id.SubscriptionId, billingContainerName, 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.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistryBillingContainerBillingContainersRestClient.GetAsync(Id.SubscriptionId, billingContainerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(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.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the billing container. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistryBillingContainerBillingContainersRestClient.Get(Id.SubscriptionId, billingContainerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.Serialization.cs new file mode 100644 index 000000000000..f48fcb69c9e9 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistryBillingContainerData : 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(DeviceRegistryBillingContainerData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + } + + DeviceRegistryBillingContainerData 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(DeviceRegistryBillingContainerData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryBillingContainerData(document.RootElement, options); + } + + internal static DeviceRegistryBillingContainerData DeserializeDeviceRegistryBillingContainerData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BillingContainerProperties properties = default; + ETag? etag = 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 = BillingContainerProperties.DeserializeBillingContainerProperties(property.Value, options); + continue; + } + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryBillingContainerData( + id, + name, + type, + systemData, + properties, + etag, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryBillingContainerData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryBillingContainerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryBillingContainerData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryBillingContainerData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.cs new file mode 100644 index 000000000000..e1c8d2edcce7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerData.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.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistryBillingContainer data model. + /// billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources under a subscription. + /// + public partial class DeviceRegistryBillingContainerData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DeviceRegistryBillingContainerData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Resource ETag. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryBillingContainerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingContainerProperties properties, ETag? etag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + internal BillingContainerProperties Properties { get; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? BillingContainerProvisioningState + { + get => Properties?.ProvisioningState; + } + + /// Resource ETag. + public ETag? ETag { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.Serialization.cs new file mode 100644 index 000000000000..7fe2dac27521 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.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.DeviceRegistry +{ + public partial class DeviceRegistryBillingContainerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistryBillingContainerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistryBillingContainerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.cs new file mode 100644 index 000000000000..042cd94d743e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryBillingContainerResource.cs @@ -0,0 +1,170 @@ +// 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.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistryBillingContainer 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 GetDeviceRegistryBillingContainerResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistryBillingContainer method. + /// + public partial class DeviceRegistryBillingContainerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The billingContainerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string billingContainerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistryBillingContainerBillingContainersClientDiagnostics; + private readonly BillingContainersRestOperations _deviceRegistryBillingContainerBillingContainersRestClient; + private readonly DeviceRegistryBillingContainerData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/billingContainers"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryBillingContainerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistryBillingContainerResource(ArmClient client, DeviceRegistryBillingContainerData 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 DeviceRegistryBillingContainerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryBillingContainerBillingContainersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistryBillingContainerBillingContainersApiVersion); + _deviceRegistryBillingContainerBillingContainersRestClient = new BillingContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryBillingContainerBillingContainersApiVersion); +#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 DeviceRegistryBillingContainerData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryBillingContainerBillingContainersRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryBillingContainerBillingContainersClientDiagnostics.CreateScope("DeviceRegistryBillingContainerResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistryBillingContainerBillingContainersRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryBillingContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetCollection.cs new file mode 100644 index 000000000000..ca4ac6e34ea6 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistryDiscoveredAssets method from an instance of . + /// + public partial class DeviceRegistryDiscoveredAssetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics; + private readonly DiscoveredAssetsRestOperations _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryDiscoveredAssetCollection() + { + } + + /// 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 DeviceRegistryDiscoveredAssetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryDiscoveredAssetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistryDiscoveredAssetResource.ResourceType, out string deviceRegistryDiscoveredAssetDiscoveredAssetsApiVersion); + _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient = new DiscoveredAssetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryDiscoveredAssetDiscoveredAssetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Discovered Asset name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, data, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetOperationSource(Client), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Discovered Asset name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, data, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetOperationSource(Client), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DiscoveredAsset resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetResource(Client, DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(e)), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, "DeviceRegistryDiscoveredAssetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAsset resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetResource(Client, DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(e)), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, "DeviceRegistryDiscoveredAssetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.Serialization.cs new file mode 100644 index 000000000000..2784870791b5 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistryDiscoveredAssetData : 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(DeviceRegistryDiscoveredAssetData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + DeviceRegistryDiscoveredAssetData 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(DeviceRegistryDiscoveredAssetData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement, options); + } + + internal static DeviceRegistryDiscoveredAssetData DeserializeDeviceRegistryDiscoveredAssetData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeviceRegistryDiscoveredAssetProperties properties = default; + DeviceRegistryExtendedLocation extendedLocation = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DeviceRegistryDiscoveredAssetProperties.DeserializeDeviceRegistryDiscoveredAssetProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = DeviceRegistryExtendedLocation.DeserializeDeviceRegistryExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDiscoveredAssetData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDiscoveredAssetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.cs new file mode 100644 index 000000000000..5c9852ce6783 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetData.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistryDiscoveredAsset data model. + /// Discovered Asset definition. + /// + public partial class DeviceRegistryDiscoveredAssetData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The extended location. + /// is null. + public DeviceRegistryDiscoveredAssetData(AzureLocation location, DeviceRegistryExtendedLocation extendedLocation) : base(location) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The extended location. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDiscoveredAssetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DeviceRegistryDiscoveredAssetProperties properties, DeviceRegistryExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDiscoveredAssetData() + { + } + + /// The resource-specific properties for this resource. + public DeviceRegistryDiscoveredAssetProperties Properties { get; set; } + /// The extended location. + public DeviceRegistryExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs new file mode 100644 index 000000000000..c072b948605e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistryDiscoveredAssetEndpointProfiles method from an instance of . + /// + public partial class DeviceRegistryDiscoveredAssetEndpointProfileCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics; + private readonly DiscoveredAssetEndpointProfilesRestOperations _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryDiscoveredAssetEndpointProfileCollection() + { + } + + /// 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 DeviceRegistryDiscoveredAssetEndpointProfileCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryDiscoveredAssetEndpointProfileResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistryDiscoveredAssetEndpointProfileResource.ResourceType, out string deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesApiVersion); + _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient = new DiscoveredAssetEndpointProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Discovered Asset Endpoint Profile name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, data, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetEndpointProfileOperationSource(Client), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Discovered Asset Endpoint Profile name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, data, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetEndpointProfileOperationSource(Client), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DiscoveredAssetEndpointProfile resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(e)), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, "DeviceRegistryDiscoveredAssetEndpointProfileCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAssetEndpointProfile resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(e)), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, "DeviceRegistryDiscoveredAssetEndpointProfileCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, discoveredAssetEndpointProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.Serialization.cs new file mode 100644 index 000000000000..7ce6d93e075a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistryDiscoveredAssetEndpointProfileData : 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(DeviceRegistryDiscoveredAssetEndpointProfileData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + DeviceRegistryDiscoveredAssetEndpointProfileData 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(DeviceRegistryDiscoveredAssetEndpointProfileData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement, options); + } + + internal static DeviceRegistryDiscoveredAssetEndpointProfileData DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DiscoveredAssetEndpointProfileProperties properties = default; + DeviceRegistryExtendedLocation extendedLocation = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DiscoveredAssetEndpointProfileProperties.DeserializeDiscoveredAssetEndpointProfileProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = DeviceRegistryExtendedLocation.DeserializeDeviceRegistryExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDiscoveredAssetEndpointProfileData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetEndpointProfileData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDiscoveredAssetEndpointProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetEndpointProfileData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.cs new file mode 100644 index 000000000000..9f487d88541a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileData.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistryDiscoveredAssetEndpointProfile data model. + /// Discovered Asset Endpoint Profile definition. + /// + public partial class DeviceRegistryDiscoveredAssetEndpointProfileData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The extended location. + /// is null. + public DeviceRegistryDiscoveredAssetEndpointProfileData(AzureLocation location, DeviceRegistryExtendedLocation extendedLocation) : base(location) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The extended location. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDiscoveredAssetEndpointProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DiscoveredAssetEndpointProfileProperties properties, DeviceRegistryExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDiscoveredAssetEndpointProfileData() + { + } + + /// The resource-specific properties for this resource. + public DiscoveredAssetEndpointProfileProperties Properties { get; set; } + /// The extended location. + public DeviceRegistryExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.Serialization.cs new file mode 100644 index 000000000000..b6d0bc5086b3 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.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.DeviceRegistry +{ + public partial class DeviceRegistryDiscoveredAssetEndpointProfileResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistryDiscoveredAssetEndpointProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistryDiscoveredAssetEndpointProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.cs new file mode 100644 index 000000000000..6e7b61788f5a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetEndpointProfileResource.cs @@ -0,0 +1,707 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistryDiscoveredAssetEndpointProfile 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 GetDeviceRegistryDiscoveredAssetEndpointProfileResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistryDiscoveredAssetEndpointProfile method. + /// + public partial class DeviceRegistryDiscoveredAssetEndpointProfileResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The discoveredAssetEndpointProfileName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics; + private readonly DiscoveredAssetEndpointProfilesRestOperations _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient; + private readonly DeviceRegistryDiscoveredAssetEndpointProfileData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryDiscoveredAssetEndpointProfileResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistryDiscoveredAssetEndpointProfileResource(ArmClient client, DeviceRegistryDiscoveredAssetEndpointProfileData 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 DeviceRegistryDiscoveredAssetEndpointProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesApiVersion); + _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient = new DiscoveredAssetEndpointProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesApiVersion); +#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 DeviceRegistryDiscoveredAssetEndpointProfileData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Delete"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(_deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Delete"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DeviceRegistryArmOperation(_deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Update"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetEndpointProfileOperationSource(Client), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.Update"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetEndpointProfileOperationSource(Client), _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetEndpointProfileResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetEndpointProfilePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.Serialization.cs new file mode 100644 index 000000000000..9904db2f0638 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.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.DeviceRegistry +{ + public partial class DeviceRegistryDiscoveredAssetResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistryDiscoveredAssetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistryDiscoveredAssetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.cs new file mode 100644 index 000000000000..3ea76bdb734f --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistryDiscoveredAssetResource.cs @@ -0,0 +1,707 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistryDiscoveredAsset 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 GetDeviceRegistryDiscoveredAssetResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistryDiscoveredAsset method. + /// + public partial class DeviceRegistryDiscoveredAssetResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The discoveredAssetName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string discoveredAssetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics; + private readonly DiscoveredAssetsRestOperations _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient; + private readonly DeviceRegistryDiscoveredAssetData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/discoveredAssets"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistryDiscoveredAssetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistryDiscoveredAssetResource(ArmClient client, DeviceRegistryDiscoveredAssetData 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 DeviceRegistryDiscoveredAssetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistryDiscoveredAssetDiscoveredAssetsApiVersion); + _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient = new DiscoveredAssetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistryDiscoveredAssetDiscoveredAssetsApiVersion); +#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 DeviceRegistryDiscoveredAssetData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Delete"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(_deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Delete"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DeviceRegistryArmOperation(_deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DeviceRegistryDiscoveredAssetPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Update"); + scope.Start(); + try + { + var response = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetOperationSource(Client), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a DiscoveredAsset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DeviceRegistryDiscoveredAssetPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.Update"); + scope.Start(); + try + { + var response = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistryDiscoveredAssetOperationSource(Client), _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} + /// + /// + /// Operation Id + /// DiscoveredAsset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics.CreateScope("DeviceRegistryDiscoveredAssetResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistryDiscoveredAssetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistryDiscoveredAssetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaCollection.cs new file mode 100644 index 000000000000..d4f9187fa327 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistrySchemas method from an instance of . + /// + public partial class DeviceRegistrySchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistrySchemaSchemasClientDiagnostics; + private readonly SchemasRestOperations _deviceRegistrySchemaSchemasRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaCollection() + { + } + + /// 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 DeviceRegistrySchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaSchemasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistrySchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistrySchemaResource.ResourceType, out string deviceRegistrySchemaSchemasApiVersion); + _deviceRegistrySchemaSchemasRestClient = new SchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaSchemasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DeviceRegistrySchemaRegistryResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DeviceRegistrySchemaRegistryResource.ResourceType), nameof(id)); + } + + /// + /// Create a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaName, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, data, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaName, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, data, cancellationToken); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Schema resources by SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas + /// + /// + /// Operation Id + /// Schema_ListBySchemaRegistry + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaSchemasRestClient.CreateListBySchemaRegistryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaSchemasRestClient.CreateListBySchemaRegistryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaResource(Client, DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(e)), _deviceRegistrySchemaSchemasClientDiagnostics, Pipeline, "DeviceRegistrySchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Schema resources by SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas + /// + /// + /// Operation Id + /// Schema_ListBySchemaRegistry + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaSchemasRestClient.CreateListBySchemaRegistryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaSchemasRestClient.CreateListBySchemaRegistryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaResource(Client, DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(e)), _deviceRegistrySchemaSchemasClientDiagnostics, Pipeline, "DeviceRegistrySchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.Serialization.cs new file mode 100644 index 000000000000..8dfe5b4955e5 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.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.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistrySchemaData : 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(DeviceRegistrySchemaData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DeviceRegistrySchemaData 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(DeviceRegistrySchemaData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaData(document.RootElement, options); + } + + internal static DeviceRegistrySchemaData DeserializeDeviceRegistrySchemaData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeviceRegistrySchemaProperties 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 = DeviceRegistrySchemaProperties.DeserializeDeviceRegistrySchemaProperties(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 DeviceRegistrySchemaData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.cs new file mode 100644 index 000000000000..d13f17f7b433 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistrySchema data model. + /// Schema definition. + /// + public partial class DeviceRegistrySchemaData : 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 DeviceRegistrySchemaData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DeviceRegistrySchemaProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DeviceRegistrySchemaProperties Properties { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryCollection.cs new file mode 100644 index 000000000000..d55dd875c8b1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistrySchemaRegistries method from an instance of . + /// + public partial class DeviceRegistrySchemaRegistryCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics; + private readonly SchemaRegistriesRestOperations _deviceRegistrySchemaRegistrySchemaRegistriesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaRegistryCollection() + { + } + + /// 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 DeviceRegistrySchemaRegistryCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistrySchemaRegistryResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistrySchemaRegistryResource.ResourceType, out string deviceRegistrySchemaRegistrySchemaRegistriesApiVersion); + _deviceRegistrySchemaRegistrySchemaRegistriesRestClient = new SchemaRegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaRegistrySchemaRegistriesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema registry name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaRegistryName, DeviceRegistrySchemaRegistryData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, data, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistrySchemaRegistryOperationSource(Client), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema registry name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaRegistryName, DeviceRegistrySchemaRegistryData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, data, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistrySchemaRegistryOperationSource(Client), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List SchemaRegistry resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaRegistryResource(Client, DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(e)), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, "DeviceRegistrySchemaRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List SchemaRegistry resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaRegistryResource(Client, DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(e)), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, "DeviceRegistrySchemaRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schemaRegistryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.Serialization.cs new file mode 100644 index 000000000000..7354fa0f6b95 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistrySchemaRegistryData : 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(DeviceRegistrySchemaRegistryData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + } + + DeviceRegistrySchemaRegistryData 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(DeviceRegistrySchemaRegistryData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaRegistryData(document.RootElement, options); + } + + internal static DeviceRegistrySchemaRegistryData DeserializeDeviceRegistrySchemaRegistryData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeviceRegistrySchemaRegistryProperties properties = default; + ManagedServiceIdentity identity = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DeviceRegistrySchemaRegistryProperties.DeserializeDeviceRegistrySchemaRegistryProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistrySchemaRegistryData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaRegistryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaRegistryData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.cs new file mode 100644 index 000000000000..eb1d2e0bea9b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistrySchemaRegistry data model. + /// Schema registry definition. + /// + public partial class DeviceRegistrySchemaRegistryData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public DeviceRegistrySchemaRegistryData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaRegistryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DeviceRegistrySchemaRegistryProperties properties, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistrySchemaRegistryData() + { + } + + /// The resource-specific properties for this resource. + public DeviceRegistrySchemaRegistryProperties Properties { get; set; } + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.Serialization.cs new file mode 100644 index 000000000000..897d9aa090f7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.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.DeviceRegistry +{ + public partial class DeviceRegistrySchemaRegistryResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistrySchemaRegistryData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistrySchemaRegistryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.cs new file mode 100644 index 000000000000..505e7a6e7853 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaRegistryResource.cs @@ -0,0 +1,776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistrySchemaRegistry 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 GetDeviceRegistrySchemaRegistryResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistrySchemaRegistry method. + /// + public partial class DeviceRegistrySchemaRegistryResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schemaRegistryName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics; + private readonly SchemaRegistriesRestOperations _deviceRegistrySchemaRegistrySchemaRegistriesRestClient; + private readonly DeviceRegistrySchemaRegistryData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/schemaRegistries"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaRegistryResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistrySchemaRegistryResource(ArmClient client, DeviceRegistrySchemaRegistryData 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 DeviceRegistrySchemaRegistryResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistrySchemaRegistrySchemaRegistriesApiVersion); + _deviceRegistrySchemaRegistrySchemaRegistriesRestClient = new SchemaRegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaRegistrySchemaRegistriesApiVersion); +#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 DeviceRegistrySchemaRegistryData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DeviceRegistrySchemaResources in the DeviceRegistrySchemaRegistry. + /// An object representing collection of DeviceRegistrySchemaResources and their operations over a DeviceRegistrySchemaResource. + public virtual DeviceRegistrySchemaCollection GetDeviceRegistrySchemas() + { + return GetCachedClient(client => new DeviceRegistrySchemaCollection(client, Id)); + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistrySchemaAsync(string schemaName, CancellationToken cancellationToken = default) + { + return await GetDeviceRegistrySchemas().GetAsync(schemaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistrySchema(string schemaName, CancellationToken cancellationToken = default) + { + return GetDeviceRegistrySchemas().Get(schemaName, cancellationToken); + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Delete"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(_deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Delete"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DeviceRegistryArmOperation(_deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DeviceRegistrySchemaRegistryPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Update"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DeviceRegistryArmOperation(new DeviceRegistrySchemaRegistryOperationSource(Client), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Update + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DeviceRegistrySchemaRegistryPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.Update"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DeviceRegistryArmOperation(new DeviceRegistrySchemaRegistryOperationSource(Client), _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics.CreateScope("DeviceRegistrySchemaRegistryResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _deviceRegistrySchemaRegistrySchemaRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DeviceRegistrySchemaRegistryResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DeviceRegistrySchemaRegistryPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.Serialization.cs new file mode 100644 index 000000000000..c51484b85598 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.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.DeviceRegistry +{ + public partial class DeviceRegistrySchemaResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistrySchemaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistrySchemaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.cs new file mode 100644 index 000000000000..1595594bf11e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaResource.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistrySchema 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 GetDeviceRegistrySchemaResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistrySchema method. + /// + public partial class DeviceRegistrySchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schemaRegistryName. + /// The schemaName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistrySchemaSchemasClientDiagnostics; + private readonly SchemasRestOperations _deviceRegistrySchemaSchemasRestClient; + private readonly DeviceRegistrySchemaData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/schemaRegistries/schemas"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistrySchemaResource(ArmClient client, DeviceRegistrySchemaData 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 DeviceRegistrySchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaSchemasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistrySchemaSchemasApiVersion); + _deviceRegistrySchemaSchemasRestClient = new SchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaSchemasApiVersion); +#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 DeviceRegistrySchemaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DeviceRegistrySchemaVersionResources in the DeviceRegistrySchema. + /// An object representing collection of DeviceRegistrySchemaVersionResources and their operations over a DeviceRegistrySchemaVersionResource. + public virtual DeviceRegistrySchemaVersionCollection GetDeviceRegistrySchemaVersions() + { + return GetCachedClient(client => new DeviceRegistrySchemaVersionCollection(client, Id)); + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistrySchemaVersionAsync(string schemaVersionName, CancellationToken cancellationToken = default) + { + return await GetDeviceRegistrySchemaVersions().GetAsync(schemaVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistrySchemaVersion(string schemaVersionName, CancellationToken cancellationToken = default) + { + return GetDeviceRegistrySchemaVersions().Get(schemaVersionName, cancellationToken); + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Delete"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Delete"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Update"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaSchemasRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// Schema_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaSchemasClientDiagnostics.CreateScope("DeviceRegistrySchemaResource.Update"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaSchemasRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _deviceRegistrySchemaSchemasRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionCollection.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionCollection.cs new file mode 100644 index 000000000000..407f152b4d61 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// 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 GetDeviceRegistrySchemaVersions method from an instance of . + /// + public partial class DeviceRegistrySchemaVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics; + private readonly SchemaVersionsRestOperations _deviceRegistrySchemaVersionSchemaVersionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaVersionCollection() + { + } + + /// 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 DeviceRegistrySchemaVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistrySchemaVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DeviceRegistrySchemaVersionResource.ResourceType, out string deviceRegistrySchemaVersionSchemaVersionsApiVersion); + _deviceRegistrySchemaVersionSchemaVersionsRestClient = new SchemaVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaVersionSchemaVersionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DeviceRegistrySchemaResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DeviceRegistrySchemaResource.ResourceType), nameof(id)); + } + + /// + /// Create a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema version name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaVersionName, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, data, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema version name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaVersionName, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, data, cancellationToken); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List SchemaVersion resources by Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions + /// + /// + /// Operation Id + /// SchemaVersion_ListBySchema + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateListBySchemaRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateListBySchemaNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaVersionResource(Client, DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(e)), _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics, Pipeline, "DeviceRegistrySchemaVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List SchemaVersion resources by Schema + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions + /// + /// + /// Operation Id + /// SchemaVersion_ListBySchema + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateListBySchemaRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateListBySchemaNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaVersionResource(Client, DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(e)), _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics, Pipeline, "DeviceRegistrySchemaVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.Exists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema version name parameter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.Serialization.cs new file mode 100644 index 000000000000..d96a3df6d156 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.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.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + public partial class DeviceRegistrySchemaVersionData : 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(DeviceRegistrySchemaVersionData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DeviceRegistrySchemaVersionData 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(DeviceRegistrySchemaVersionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaVersionData(document.RootElement, options); + } + + internal static DeviceRegistrySchemaVersionData DeserializeDeviceRegistrySchemaVersionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeviceRegistrySchemaVersionProperties 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 = DeviceRegistrySchemaVersionProperties.DeserializeDeviceRegistrySchemaVersionProperties(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 DeviceRegistrySchemaVersionData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaVersionData)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaVersionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaVersionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.cs new file mode 100644 index 000000000000..f586a3ab5a4e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DeviceRegistry.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A class representing the DeviceRegistrySchemaVersion data model. + /// Schema version's definition. + /// + public partial class DeviceRegistrySchemaVersionData : 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 DeviceRegistrySchemaVersionData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DeviceRegistrySchemaVersionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DeviceRegistrySchemaVersionProperties Properties { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.Serialization.cs new file mode 100644 index 000000000000..d763369b0fa7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.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.DeviceRegistry +{ + public partial class DeviceRegistrySchemaVersionResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DeviceRegistrySchemaVersionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DeviceRegistrySchemaVersionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.cs new file mode 100644 index 000000000000..ab0953217832 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/DeviceRegistrySchemaVersionResource.cs @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DeviceRegistry +{ + /// + /// A Class representing a DeviceRegistrySchemaVersion 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 GetDeviceRegistrySchemaVersionResource method. + /// Otherwise you can get one from its parent resource using the GetDeviceRegistrySchemaVersion method. + /// + public partial class DeviceRegistrySchemaVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schemaRegistryName. + /// The schemaName. + /// The schemaVersionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics; + private readonly SchemaVersionsRestOperations _deviceRegistrySchemaVersionSchemaVersionsRestClient; + private readonly DeviceRegistrySchemaVersionData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DeviceRegistry/schemaRegistries/schemas/schemaVersions"; + + /// Initializes a new instance of the class for mocking. + protected DeviceRegistrySchemaVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DeviceRegistrySchemaVersionResource(ArmClient client, DeviceRegistrySchemaVersionData 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 DeviceRegistrySchemaVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string deviceRegistrySchemaVersionSchemaVersionsApiVersion); + _deviceRegistrySchemaVersionSchemaVersionsRestClient = new SchemaVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deviceRegistrySchemaVersionSchemaVersionsApiVersion); +#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 DeviceRegistrySchemaVersionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Get"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Get"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Delete"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_Delete + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Delete"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Update"); + scope.Start(); + try + { + var response = await _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateOrReplaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SchemaVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName} + /// + /// + /// Operation Id + /// SchemaVersion_CreateOrReplace + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _deviceRegistrySchemaVersionSchemaVersionsClientDiagnostics.CreateScope("DeviceRegistrySchemaVersionResource.Update"); + scope.Start(); + try + { + var response = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateOrReplace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _deviceRegistrySchemaVersionSchemaVersionsRestClient.CreateCreateOrReplaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DeviceRegistryArmOperation(Response.FromValue(new DeviceRegistrySchemaVersionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/DeviceRegistryExtensions.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/DeviceRegistryExtensions.cs index 9a43aad66d0e..40c653c8fa45 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/DeviceRegistryExtensions.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/DeviceRegistryExtensions.cs @@ -32,6 +32,25 @@ private static MockableDeviceRegistrySubscriptionResource GetMockableDeviceRegis return resource.GetCachedClient(client => new MockableDeviceRegistrySubscriptionResource(client, resource.Id)); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DeviceRegistryAssetResource GetDeviceRegistryAssetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistryAssetResource(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. @@ -52,352 +71,1035 @@ public static DeviceRegistryAssetEndpointProfileResource GetDeviceRegistryAssetE } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// 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 DeviceRegistryAssetResource GetDeviceRegistryAssetResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistryAssetResource(id); + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistryBillingContainerResource(id); } /// - /// Gets a collection of DeviceRegistryAssetEndpointProfileResources in the ResourceGroupResource. + /// 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. + /// 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 DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistryDiscoveredAssetResource(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 DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistryDiscoveredAssetEndpointProfileResource(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 DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistrySchemaRegistryResource(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 DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistrySchemaResource(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 DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDeviceRegistryArmClient(client).GetDeviceRegistrySchemaVersionResource(id); + } + + /// + /// Gets a collection of DeviceRegistryAssetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of DeviceRegistryAssetEndpointProfileResources and their operations over a DeviceRegistryAssetEndpointProfileResource. - public static DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAssetEndpointProfiles(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of DeviceRegistryAssetResources and their operations over a DeviceRegistryAssetResource. + public static DeviceRegistryAssetCollection GetDeviceRegistryAssets(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfiles(); + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssets(); } /// - /// Get a AssetEndpointProfile + /// Get a Asset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Asset Endpoint Profile name parameter. + /// Asset name parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetDeviceRegistryAssetEndpointProfileAsync(this ResourceGroupResource resourceGroupResource, string assetEndpointProfileName, CancellationToken cancellationToken = default) + public static async Task> GetDeviceRegistryAssetAsync(this ResourceGroupResource resourceGroupResource, string assetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfileAsync(assetEndpointProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetAsync(assetName, cancellationToken).ConfigureAwait(false); } /// - /// Get a AssetEndpointProfile + /// Get a Asset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// Asset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Asset Endpoint Profile name parameter. + /// Asset name parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetDeviceRegistryAssetEndpointProfile(this ResourceGroupResource resourceGroupResource, string assetEndpointProfileName, CancellationToken cancellationToken = default) + public static Response GetDeviceRegistryAsset(this ResourceGroupResource resourceGroupResource, string assetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfile(assetEndpointProfileName, cancellationToken); + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAsset(assetName, cancellationToken); } /// - /// Gets a collection of DeviceRegistryAssetResources in the ResourceGroupResource. + /// Gets a collection of DeviceRegistryAssetEndpointProfileResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of DeviceRegistryAssetResources and their operations over a DeviceRegistryAssetResource. - public static DeviceRegistryAssetCollection GetDeviceRegistryAssets(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of DeviceRegistryAssetEndpointProfileResources and their operations over a DeviceRegistryAssetEndpointProfileResource. + public static DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAssetEndpointProfiles(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssets(); + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfiles(); } /// - /// Get a Asset + /// Get a AssetEndpointProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName} /// /// /// Operation Id - /// Assets_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Asset name parameter. + /// Asset Endpoint Profile name parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetDeviceRegistryAssetAsync(this ResourceGroupResource resourceGroupResource, string assetName, CancellationToken cancellationToken = default) + public static async Task> GetDeviceRegistryAssetEndpointProfileAsync(this ResourceGroupResource resourceGroupResource, string assetEndpointProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetAsync(assetName, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfileAsync(assetEndpointProfileName, cancellationToken).ConfigureAwait(false); } /// - /// Get a Asset + /// Get a AssetEndpointProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName} /// /// /// Operation Id - /// Assets_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Asset name parameter. + /// Asset Endpoint Profile name parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetDeviceRegistryAsset(this ResourceGroupResource resourceGroupResource, string assetName, CancellationToken cancellationToken = default) + public static Response GetDeviceRegistryAssetEndpointProfile(this ResourceGroupResource resourceGroupResource, string assetEndpointProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAsset(assetName, cancellationToken); + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryAssetEndpointProfile(assetEndpointProfileName, cancellationToken); } /// - /// List AssetEndpointProfile resources by subscription ID + /// Gets a collection of DeviceRegistryDiscoveredAssetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DeviceRegistryDiscoveredAssetResources and their operations over a DeviceRegistryDiscoveredAssetResource. + public static DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAssets(); + } + + /// + /// Get a DiscoveredAsset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} /// /// /// Operation Id - /// AssetEndpointProfiles_ListBySubscription + /// DiscoveredAsset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Discovered Asset name parameter. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeviceRegistryDiscoveredAssetAsync(this ResourceGroupResource resourceGroupResource, string discoveredAssetName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetEndpointProfilesAsync(cancellationToken); + return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAssetAsync(discoveredAssetName, cancellationToken).ConfigureAwait(false); } /// - /// List AssetEndpointProfile resources by subscription ID + /// Get a DiscoveredAsset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} /// /// /// Operation Id - /// AssetEndpointProfiles_ListBySubscription + /// DiscoveredAsset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Discovered Asset name parameter. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetDeviceRegistryAssetEndpointProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDeviceRegistryDiscoveredAsset(this ResourceGroupResource resourceGroupResource, string discoveredAssetName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetEndpointProfiles(cancellationToken); + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAsset(discoveredAssetName, cancellationToken); } /// - /// List Asset resources by subscription ID + /// Gets a collection of DeviceRegistryDiscoveredAssetEndpointProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DeviceRegistryDiscoveredAssetEndpointProfileResources and their operations over a DeviceRegistryDiscoveredAssetEndpointProfileResource. + public static DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAssetEndpointProfiles(); + } + + /// + /// Get a DiscoveredAssetEndpointProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} /// /// /// Operation Id - /// Assets_ListBySubscription + /// DiscoveredAssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Discovered Asset Endpoint Profile name parameter. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetDeviceRegistryAssetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(this ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetsAsync(cancellationToken); + return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(discoveredAssetEndpointProfileName, cancellationToken).ConfigureAwait(false); } /// - /// List Asset resources by subscription ID + /// Get a DiscoveredAssetEndpointProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} /// /// /// Operation Id - /// Assets_ListBySubscription + /// DiscoveredAssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// Discovered Asset Endpoint Profile name parameter. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetDeviceRegistryAssets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDeviceRegistryDiscoveredAssetEndpointProfile(this ResourceGroupResource resourceGroupResource, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistryDiscoveredAssetEndpointProfile(discoveredAssetEndpointProfileName, cancellationToken); + } + + /// + /// Gets a collection of DeviceRegistrySchemaRegistryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DeviceRegistrySchemaRegistryResources and their operations over a DeviceRegistrySchemaRegistryResource. + public static DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistrySchemaRegistries(); + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Schema registry name parameter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeviceRegistrySchemaRegistryAsync(this ResourceGroupResource resourceGroupResource, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistrySchemaRegistryAsync(schemaRegistryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Schema registry name parameter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDeviceRegistrySchemaRegistry(this ResourceGroupResource resourceGroupResource, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDeviceRegistryResourceGroupResource(resourceGroupResource).GetDeviceRegistrySchemaRegistry(schemaRegistryName, cancellationToken); + } + + /// + /// Gets a collection of DeviceRegistryBillingContainerResources 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 DeviceRegistryBillingContainerResources and their operations over a DeviceRegistryBillingContainerResource. + public static DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryBillingContainers(); + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the billing container. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeviceRegistryBillingContainerAsync(this SubscriptionResource subscriptionResource, string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryBillingContainerAsync(billingContainerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BillingContainer + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} + /// + /// + /// Operation Id + /// BillingContainer_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the billing container. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDeviceRegistryBillingContainer(this SubscriptionResource subscriptionResource, string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryBillingContainer(billingContainerName, cancellationToken); + } + + /// + /// List Asset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets + /// + /// + /// Operation Id + /// Asset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeviceRegistryAssetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetsAsync(cancellationToken); + } + + /// + /// List Asset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets + /// + /// + /// Operation Id + /// Asset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeviceRegistryAssets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssets(cancellationToken); } + + /// + /// List AssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// + /// + /// Operation Id + /// AssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetEndpointProfilesAsync(cancellationToken); + } + + /// + /// List AssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// + /// + /// Operation Id + /// AssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeviceRegistryAssetEndpointProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryAssetEndpointProfiles(cancellationToken); + } + + /// + /// List DiscoveredAsset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryDiscoveredAssetsAsync(cancellationToken); + } + + /// + /// List DiscoveredAsset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeviceRegistryDiscoveredAssets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryDiscoveredAssets(cancellationToken); + } + + /// + /// List DiscoveredAssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(cancellationToken); + } + + /// + /// List DiscoveredAssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistryDiscoveredAssetEndpointProfiles(cancellationToken); + } + + /// + /// List SchemaRegistry resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistrySchemaRegistriesAsync(cancellationToken); + } + + /// + /// List SchemaRegistry resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDeviceRegistrySchemaRegistries(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDeviceRegistrySubscriptionResource(subscriptionResource).GetDeviceRegistrySchemaRegistries(cancellationToken); + } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryArmClient.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryArmClient.cs index bfc242f9c3fe..78af7c3296d6 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryArmClient.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryArmClient.cs @@ -34,6 +34,18 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceRegistryAssetResource GetDeviceRegistryAssetResource(ResourceIdentifier id) + { + DeviceRegistryAssetResource.ValidateResourceId(id); + return new DeviceRegistryAssetResource(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. @@ -47,15 +59,75 @@ public virtual DeviceRegistryAssetEndpointProfileResource GetDeviceRegistryAsset } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual DeviceRegistryAssetResource GetDeviceRegistryAssetResource(ResourceIdentifier id) + /// Returns a object. + public virtual DeviceRegistryBillingContainerResource GetDeviceRegistryBillingContainerResource(ResourceIdentifier id) { - DeviceRegistryAssetResource.ValidateResourceId(id); - return new DeviceRegistryAssetResource(Client, id); + DeviceRegistryBillingContainerResource.ValidateResourceId(id); + return new DeviceRegistryBillingContainerResource(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 DeviceRegistryDiscoveredAssetResource GetDeviceRegistryDiscoveredAssetResource(ResourceIdentifier id) + { + DeviceRegistryDiscoveredAssetResource.ValidateResourceId(id); + return new DeviceRegistryDiscoveredAssetResource(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 DeviceRegistryDiscoveredAssetEndpointProfileResource GetDeviceRegistryDiscoveredAssetEndpointProfileResource(ResourceIdentifier id) + { + DeviceRegistryDiscoveredAssetEndpointProfileResource.ValidateResourceId(id); + return new DeviceRegistryDiscoveredAssetEndpointProfileResource(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 DeviceRegistrySchemaRegistryResource GetDeviceRegistrySchemaRegistryResource(ResourceIdentifier id) + { + DeviceRegistrySchemaRegistryResource.ValidateResourceId(id); + return new DeviceRegistrySchemaRegistryResource(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 DeviceRegistrySchemaResource GetDeviceRegistrySchemaResource(ResourceIdentifier id) + { + DeviceRegistrySchemaResource.ValidateResourceId(id); + return new DeviceRegistrySchemaResource(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 DeviceRegistrySchemaVersionResource GetDeviceRegistrySchemaVersionResource(ResourceIdentifier id) + { + DeviceRegistrySchemaVersionResource.ValidateResourceId(id); + return new DeviceRegistrySchemaVersionResource(Client, id); } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryResourceGroupResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryResourceGroupResource.cs index 8f882041830e..fb8d8c7fc9b4 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryResourceGroupResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistryResourceGroupResource.cs @@ -33,6 +33,75 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of DeviceRegistryAssetResources in the ResourceGroupResource. + /// An object representing collection of DeviceRegistryAssetResources and their operations over a DeviceRegistryAssetResource. + public virtual DeviceRegistryAssetCollection GetDeviceRegistryAssets() + { + return GetCachedClient(client => new DeviceRegistryAssetCollection(client, Id)); + } + + /// + /// Get a Asset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// + /// + /// Operation Id + /// Asset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Asset name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistryAssetAsync(string assetName, CancellationToken cancellationToken = default) + { + return await GetDeviceRegistryAssets().GetAsync(assetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Asset + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// + /// + /// Operation Id + /// Asset_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Asset name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistryAsset(string assetName, CancellationToken cancellationToken = default) + { + return GetDeviceRegistryAssets().Get(assetName, cancellationToken); + } + /// Gets a collection of DeviceRegistryAssetEndpointProfileResources in the ResourceGroupResource. /// An object representing collection of DeviceRegistryAssetEndpointProfileResources and their operations over a DeviceRegistryAssetEndpointProfileResource. public virtual DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAssetEndpointProfiles() @@ -49,11 +118,11 @@ public virtual DeviceRegistryAssetEndpointProfileCollection GetDeviceRegistryAss /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -80,11 +149,11 @@ public virtual async Task> /// /// /// Operation Id - /// AssetEndpointProfiles_Get + /// AssetEndpointProfile_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -102,73 +171,211 @@ public virtual Response GetDeviceReg return GetDeviceRegistryAssetEndpointProfiles().Get(assetEndpointProfileName, cancellationToken); } - /// Gets a collection of DeviceRegistryAssetResources in the ResourceGroupResource. - /// An object representing collection of DeviceRegistryAssetResources and their operations over a DeviceRegistryAssetResource. - public virtual DeviceRegistryAssetCollection GetDeviceRegistryAssets() + /// Gets a collection of DeviceRegistryDiscoveredAssetResources in the ResourceGroupResource. + /// An object representing collection of DeviceRegistryDiscoveredAssetResources and their operations over a DeviceRegistryDiscoveredAssetResource. + public virtual DeviceRegistryDiscoveredAssetCollection GetDeviceRegistryDiscoveredAssets() { - return GetCachedClient(client => new DeviceRegistryAssetCollection(client, Id)); + return GetCachedClient(client => new DeviceRegistryDiscoveredAssetCollection(client, Id)); } /// - /// Get a Asset + /// Get a DiscoveredAsset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} /// /// /// Operation Id - /// Assets_Get + /// DiscoveredAsset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Asset name parameter. + /// Discovered Asset name parameter. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetDeviceRegistryAssetAsync(string assetName, CancellationToken cancellationToken = default) + public virtual async Task> GetDeviceRegistryDiscoveredAssetAsync(string discoveredAssetName, CancellationToken cancellationToken = default) { - return await GetDeviceRegistryAssets().GetAsync(assetName, cancellationToken).ConfigureAwait(false); + return await GetDeviceRegistryDiscoveredAssets().GetAsync(discoveredAssetName, cancellationToken).ConfigureAwait(false); } /// - /// Get a Asset + /// Get a DiscoveredAsset /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName} /// /// /// Operation Id - /// Assets_Get + /// DiscoveredAsset_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Asset name parameter. + /// Discovered Asset name parameter. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetDeviceRegistryAsset(string assetName, CancellationToken cancellationToken = default) + public virtual Response GetDeviceRegistryDiscoveredAsset(string discoveredAssetName, CancellationToken cancellationToken = default) { - return GetDeviceRegistryAssets().Get(assetName, cancellationToken); + return GetDeviceRegistryDiscoveredAssets().Get(discoveredAssetName, cancellationToken); + } + + /// Gets a collection of DeviceRegistryDiscoveredAssetEndpointProfileResources in the ResourceGroupResource. + /// An object representing collection of DeviceRegistryDiscoveredAssetEndpointProfileResources and their operations over a DeviceRegistryDiscoveredAssetEndpointProfileResource. + public virtual DeviceRegistryDiscoveredAssetEndpointProfileCollection GetDeviceRegistryDiscoveredAssetEndpointProfiles() + { + return GetCachedClient(client => new DeviceRegistryDiscoveredAssetEndpointProfileCollection(client, Id)); + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistryDiscoveredAssetEndpointProfileAsync(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + return await GetDeviceRegistryDiscoveredAssetEndpointProfiles().GetAsync(discoveredAssetEndpointProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a DiscoveredAssetEndpointProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName} + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistryDiscoveredAssetEndpointProfile(string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + return GetDeviceRegistryDiscoveredAssetEndpointProfiles().Get(discoveredAssetEndpointProfileName, cancellationToken); + } + + /// Gets a collection of DeviceRegistrySchemaRegistryResources in the ResourceGroupResource. + /// An object representing collection of DeviceRegistrySchemaRegistryResources and their operations over a DeviceRegistrySchemaRegistryResource. + public virtual DeviceRegistrySchemaRegistryCollection GetDeviceRegistrySchemaRegistries() + { + return GetCachedClient(client => new DeviceRegistrySchemaRegistryCollection(client, Id)); + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistrySchemaRegistryAsync(string schemaRegistryName, CancellationToken cancellationToken = default) + { + return await GetDeviceRegistrySchemaRegistries().GetAsync(schemaRegistryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SchemaRegistry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Schema registry name parameter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistrySchemaRegistry(string schemaRegistryName, CancellationToken cancellationToken = default) + { + return GetDeviceRegistrySchemaRegistries().Get(schemaRegistryName, cancellationToken); } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistrySubscriptionResource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistrySubscriptionResource.cs index e4f3fc6c74f3..5f97882a97f9 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistrySubscriptionResource.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Extensions/MockableDeviceRegistrySubscriptionResource.cs @@ -5,7 +5,9 @@ #nullable disable +using System; using System.Threading; +using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; @@ -15,10 +17,16 @@ namespace Azure.ResourceManager.DeviceRegistry.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableDeviceRegistrySubscriptionResource : ArmResource { - private ClientDiagnostics _deviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics; - private AssetEndpointProfilesRestOperations _deviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient; private ClientDiagnostics _deviceRegistryAssetAssetsClientDiagnostics; private AssetsRestOperations _deviceRegistryAssetAssetsRestClient; + private ClientDiagnostics _deviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics; + private AssetEndpointProfilesRestOperations _deviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient; + private ClientDiagnostics _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics; + private DiscoveredAssetsRestOperations _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient; + private ClientDiagnostics _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics; + private DiscoveredAssetEndpointProfilesRestOperations _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient; + private ClientDiagnostics _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics; + private SchemaRegistriesRestOperations _deviceRegistrySchemaRegistrySchemaRegistriesRestClient; /// Initializes a new instance of the class for mocking. protected MockableDeviceRegistrySubscriptionResource() @@ -32,10 +40,16 @@ internal MockableDeviceRegistrySubscriptionResource(ArmClient client, ResourceId { } - private ClientDiagnostics DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics => _deviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryAssetEndpointProfileResource.ResourceType.Namespace, Diagnostics); - private AssetEndpointProfilesRestOperations DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient => _deviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient ??= new AssetEndpointProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistryAssetEndpointProfileResource.ResourceType)); private ClientDiagnostics DeviceRegistryAssetAssetsClientDiagnostics => _deviceRegistryAssetAssetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryAssetResource.ResourceType.Namespace, Diagnostics); private AssetsRestOperations DeviceRegistryAssetAssetsRestClient => _deviceRegistryAssetAssetsRestClient ??= new AssetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistryAssetResource.ResourceType)); + private ClientDiagnostics DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics => _deviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryAssetEndpointProfileResource.ResourceType.Namespace, Diagnostics); + private AssetEndpointProfilesRestOperations DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient => _deviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient ??= new AssetEndpointProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistryAssetEndpointProfileResource.ResourceType)); + private ClientDiagnostics DeviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics => _deviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryDiscoveredAssetResource.ResourceType.Namespace, Diagnostics); + private DiscoveredAssetsRestOperations DeviceRegistryDiscoveredAssetDiscoveredAssetsRestClient => _deviceRegistryDiscoveredAssetDiscoveredAssetsRestClient ??= new DiscoveredAssetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistryDiscoveredAssetResource.ResourceType)); + private ClientDiagnostics DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistryDiscoveredAssetEndpointProfileResource.ResourceType.Namespace, Diagnostics); + private DiscoveredAssetEndpointProfilesRestOperations DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient => _deviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient ??= new DiscoveredAssetEndpointProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistryDiscoveredAssetEndpointProfileResource.ResourceType)); + private ClientDiagnostics DeviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics => _deviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceRegistry", DeviceRegistrySchemaRegistryResource.ResourceType.Namespace, Diagnostics); + private SchemaRegistriesRestOperations DeviceRegistrySchemaRegistrySchemaRegistriesRestClient => _deviceRegistrySchemaRegistrySchemaRegistriesRestClient ??= new SchemaRegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceRegistrySchemaRegistryResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -43,64 +57,73 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of DeviceRegistryBillingContainerResources in the SubscriptionResource. + /// An object representing collection of DeviceRegistryBillingContainerResources and their operations over a DeviceRegistryBillingContainerResource. + public virtual DeviceRegistryBillingContainerCollection GetDeviceRegistryBillingContainers() + { + return GetCachedClient(client => new DeviceRegistryBillingContainerCollection(client, Id)); + } + /// - /// List AssetEndpointProfile resources by subscription ID + /// Get a BillingContainer /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} /// /// /// Operation Id - /// AssetEndpointProfiles_ListBySubscription + /// BillingContainer_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// + /// Name of the billing container. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceRegistryBillingContainerAsync(string billingContainerName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryAssetEndpointProfileResource(Client, DeviceRegistryAssetEndpointProfileData.DeserializeDeviceRegistryAssetEndpointProfileData(e)), DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryAssetEndpointProfiles", "value", "nextLink", cancellationToken); + return await GetDeviceRegistryBillingContainers().GetAsync(billingContainerName, cancellationToken).ConfigureAwait(false); } /// - /// List AssetEndpointProfile resources by subscription ID + /// Get a BillingContainer /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName} /// /// /// Operation Id - /// AssetEndpointProfiles_ListBySubscription + /// BillingContainer_Get /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource - /// + /// /// /// /// + /// Name of the billing container. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeviceRegistryAssetEndpointProfiles(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceRegistryBillingContainer(string billingContainerName, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryAssetEndpointProfileResource(Client, DeviceRegistryAssetEndpointProfileData.DeserializeDeviceRegistryAssetEndpointProfileData(e)), DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryAssetEndpointProfiles", "value", "nextLink", cancellationToken); + return GetDeviceRegistryBillingContainers().Get(billingContainerName, cancellationToken); } /// @@ -112,11 +135,11 @@ public virtual Pageable GetDeviceReg /// /// /// Operation Id - /// Assets_ListBySubscription + /// Asset_ListBySubscription /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -142,11 +165,11 @@ public virtual AsyncPageable GetDeviceRegistryAsset /// /// /// Operation Id - /// Assets_ListBySubscription + /// Asset_ListBySubscription /// /// /// Default Api Version - /// 2023-11-01-preview + /// 2024-09-01-preview /// /// /// Resource @@ -162,5 +185,245 @@ public virtual Pageable GetDeviceRegistryAssets(Can HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryAssetAssetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryAssetResource(Client, DeviceRegistryAssetData.DeserializeDeviceRegistryAssetData(e)), DeviceRegistryAssetAssetsClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryAssets", "value", "nextLink", cancellationToken); } + + /// + /// List AssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// + /// + /// Operation Id + /// AssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceRegistryAssetEndpointProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryAssetEndpointProfileResource(Client, DeviceRegistryAssetEndpointProfileData.DeserializeDeviceRegistryAssetEndpointProfileData(e)), DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryAssetEndpointProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// List AssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles + /// + /// + /// Operation Id + /// AssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceRegistryAssetEndpointProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryAssetEndpointProfileAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryAssetEndpointProfileResource(Client, DeviceRegistryAssetEndpointProfileData.DeserializeDeviceRegistryAssetEndpointProfileData(e)), DeviceRegistryAssetEndpointProfileAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryAssetEndpointProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAsset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceRegistryDiscoveredAssetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetResource(Client, DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(e)), DeviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryDiscoveredAssets", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAsset resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets + /// + /// + /// Operation Id + /// DiscoveredAsset_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceRegistryDiscoveredAssets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryDiscoveredAssetDiscoveredAssetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetResource(Client, DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(e)), DeviceRegistryDiscoveredAssetDiscoveredAssetsClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryDiscoveredAssets", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceRegistryDiscoveredAssetEndpointProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(e)), DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// List DiscoveredAssetEndpointProfile resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles + /// + /// + /// Operation Id + /// DiscoveredAssetEndpointProfile_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceRegistryDiscoveredAssetEndpointProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistryDiscoveredAssetEndpointProfileResource(Client, DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(e)), DeviceRegistryDiscoveredAssetEndpointProfileDiscoveredAssetEndpointProfilesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistryDiscoveredAssetEndpointProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// List SchemaRegistry resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceRegistrySchemaRegistriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaRegistryResource(Client, DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(e)), DeviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistrySchemaRegistries", "value", "nextLink", cancellationToken); + } + + /// + /// List SchemaRegistry resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries + /// + /// + /// Operation Id + /// SchemaRegistry_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceRegistrySchemaRegistries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceRegistrySchemaRegistrySchemaRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceRegistrySchemaRegistryResource(Client, DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(e)), DeviceRegistrySchemaRegistrySchemaRegistriesClientDiagnostics, Pipeline, "MockableDeviceRegistrySubscriptionResource.GetDeviceRegistrySchemaRegistries", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetEndpointProfileOperationSource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetEndpointProfileOperationSource.cs new file mode 100644 index 000000000000..54bb00650051 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetEndpointProfileOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal class DeviceRegistryDiscoveredAssetEndpointProfileOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DeviceRegistryDiscoveredAssetEndpointProfileOperationSource(ArmClient client) + { + _client = client; + } + + DeviceRegistryDiscoveredAssetEndpointProfileResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement); + return new DeviceRegistryDiscoveredAssetEndpointProfileResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement); + return new DeviceRegistryDiscoveredAssetEndpointProfileResource(_client, data); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetOperationSource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetOperationSource.cs new file mode 100644 index 000000000000..a739fa7c4dd1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistryDiscoveredAssetOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal class DeviceRegistryDiscoveredAssetOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DeviceRegistryDiscoveredAssetOperationSource(ArmClient client) + { + _client = client; + } + + DeviceRegistryDiscoveredAssetResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement); + return new DeviceRegistryDiscoveredAssetResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement); + return new DeviceRegistryDiscoveredAssetResource(_client, data); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistrySchemaRegistryOperationSource.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistrySchemaRegistryOperationSource.cs new file mode 100644 index 000000000000..360604a614b0 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/LongRunningOperation/DeviceRegistrySchemaRegistryOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal class DeviceRegistrySchemaRegistryOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DeviceRegistrySchemaRegistryOperationSource(ArmClient client) + { + _client = client; + } + + DeviceRegistrySchemaRegistryResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(document.RootElement); + return new DeviceRegistrySchemaRegistryResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(document.RootElement); + return new DeviceRegistrySchemaRegistryResource(_client, data); + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileListResult.Serialization.cs index e9e4c098bdee..57a4ca4d3797 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileListResult.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileListResult.Serialization.cs @@ -41,7 +41,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteObjectValue(item, options); } writer.WriteEndArray(); - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.Serialization.cs similarity index 61% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.Serialization.cs index f7cc67a41871..4c4a5636720e 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class AssetStatus : IUtf8JsonSerializable, IJsonModel + internal partial class AssetEndpointProfileStatus : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,13 +28,13 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetStatus)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatus)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Errors)) + if (options.Format != "W" && Optional.IsCollectionDefined(Errors)) { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); @@ -44,11 +44,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -66,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AssetStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AssetEndpointProfileStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetStatus)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAssetStatus(document.RootElement, options); + return DeserializeAssetEndpointProfileStatus(document.RootElement, options); } - internal static AssetStatus DeserializeAssetStatus(JsonElement element, ModelReaderWriterOptions options = null) + internal static AssetEndpointProfileStatus DeserializeAssetEndpointProfileStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,8 +81,7 @@ internal static AssetStatus DeserializeAssetStatus(JsonElement element, ModelRea { return null; } - IReadOnlyList errors = default; - int? version = default; + IReadOnlyList errors = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -98,61 +92,52 @@ internal static AssetStatus DeserializeAssetStatus(JsonElement element, ModelRea { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AssetStatusError.DeserializeAssetStatusError(item, options)); + array.Add(AssetEndpointProfileStatusError.DeserializeAssetEndpointProfileStatusError(item, options)); } errors = array; continue; } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt32(); - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AssetStatus(errors ?? new ChangeTrackingList(), version, serializedAdditionalRawData); + return new AssetEndpointProfileStatus(errors ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AssetStatus)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatus)} does not support writing '{options.Format}' format."); } } - AssetStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AssetEndpointProfileStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAssetStatus(document.RootElement, options); + return DeserializeAssetEndpointProfileStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AssetStatus)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatus)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.cs similarity index 65% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.cs index 406221579567..73b4bf3ecc8d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatus.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - /// Defines the asset status properties. - public partial class AssetStatus + /// Defines the asset endpoint profile status properties. + internal partial class AssetEndpointProfileStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +45,22 @@ public partial class AssetStatus /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AssetStatus() + /// Initializes a new instance of . + internal AssetEndpointProfileStatus() { - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Array object to transfer and persist errors that originate from the Edge. - /// A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. /// Keeps track of any properties unknown to the library. - internal AssetStatus(IReadOnlyList errors, int? version, IDictionary serializedAdditionalRawData) + internal AssetEndpointProfileStatus(IReadOnlyList errors, IDictionary serializedAdditionalRawData) { Errors = errors; - Version = version; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array object to transfer and persist errors that originate from the Edge. - public IReadOnlyList Errors { get; } - /// A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. - public int? Version { get; } + public IReadOnlyList Errors { get; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.Serialization.cs similarity index 65% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.Serialization.cs index 82334ac285a5..c3eec6c5eedd 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class AssetStatusError : IUtf8JsonSerializable, IJsonModel + public partial class AssetEndpointProfileStatusError : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,18 +28,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetStatusError)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatusError)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Code)) + if (options.Format != "W" && Optional.IsDefined(Code)) { writer.WritePropertyName("code"u8); writer.WriteNumberValue(Code.Value); } - if (Optional.IsDefined(Message)) + if (options.Format != "W" && Optional.IsDefined(Message)) { writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AssetStatusError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AssetEndpointProfileStatusError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetStatusError)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatusError)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAssetStatusError(document.RootElement, options); + return DeserializeAssetEndpointProfileStatusError(document.RootElement, options); } - internal static AssetStatusError DeserializeAssetStatusError(JsonElement element, ModelReaderWriterOptions options = null) + internal static AssetEndpointProfileStatusError DeserializeAssetEndpointProfileStatusError(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -107,38 +107,38 @@ internal static AssetStatusError DeserializeAssetStatusError(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AssetStatusError(code, message, serializedAdditionalRawData); + return new AssetEndpointProfileStatusError(code, message, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AssetStatusError)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatusError)} does not support writing '{options.Format}' format."); } } - AssetStatusError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AssetEndpointProfileStatusError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAssetStatusError(document.RootElement, options); + return DeserializeAssetEndpointProfileStatusError(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AssetStatusError)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AssetEndpointProfileStatusError)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.cs new file mode 100644 index 000000000000..361e9a256c37 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileStatusError.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the asset endpoint profile status error properties. + public partial class AssetEndpointProfileStatusError + { + /// + /// 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 AssetEndpointProfileStatusError() + { + } + + /// Initializes a new instance of . + /// Error code for classification of errors (ex: 400, 404, 500, etc.). + /// Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not a valid url”). + /// Keeps track of any properties unknown to the library. + internal AssetEndpointProfileStatusError(int? code, string message, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Error code for classification of errors (ex: 400, 404, 500, etc.). + public int? Code { get; } + /// Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not a valid url”). + public string Message { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..1439930dd4b7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class AssetEndpointProfileUpdateProperties : 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(AssetEndpointProfileUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(TargetAddress)) + { + writer.WritePropertyName("targetAddress"u8); + writer.WriteStringValue(TargetAddress.AbsoluteUri); + } + if (Optional.IsDefined(EndpointProfileType)) + { + writer.WritePropertyName("endpointProfileType"u8); + writer.WriteStringValue(EndpointProfileType); + } + if (Optional.IsDefined(Authentication)) + { + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + } + if (Optional.IsDefined(AdditionalConfiguration)) + { + writer.WritePropertyName("additionalConfiguration"u8); + writer.WriteStringValue(AdditionalConfiguration); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AssetEndpointProfileUpdateProperties 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(AssetEndpointProfileUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetEndpointProfileUpdateProperties(document.RootElement, options); + } + + internal static AssetEndpointProfileUpdateProperties DeserializeAssetEndpointProfileUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri targetAddress = default; + string endpointProfileType = default; + DeviceRegistryAuthentication authentication = default; + string additionalConfiguration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetAddress = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpointProfileType"u8)) + { + endpointProfileType = property.Value.GetString(); + continue; + } + if (property.NameEquals("authentication"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authentication = DeviceRegistryAuthentication.DeserializeDeviceRegistryAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("additionalConfiguration"u8)) + { + additionalConfiguration = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetEndpointProfileUpdateProperties(targetAddress, endpointProfileType, authentication, additionalConfiguration, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetEndpointProfileUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AssetEndpointProfileUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetEndpointProfileUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetEndpointProfileUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.cs new file mode 100644 index 000000000000..90504fc6d069 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEndpointProfileUpdateProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The updatable properties of the AssetEndpointProfile. + public partial class AssetEndpointProfileUpdateProperties + { + /// + /// 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 AssetEndpointProfileUpdateProperties() + { + } + + /// Initializes a new instance of . + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Defines the client authentication mechanism to the server. + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// Keeps track of any properties unknown to the library. + internal AssetEndpointProfileUpdateProperties(Uri targetAddress, string endpointProfileType, DeviceRegistryAuthentication authentication, string additionalConfiguration, IDictionary serializedAdditionalRawData) + { + TargetAddress = targetAddress; + EndpointProfileType = endpointProfileType; + Authentication = authentication; + AdditionalConfiguration = additionalConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + public Uri TargetAddress { get; set; } + /// Defines the configuration for the connector type that is being used with the endpoint profile. + public string EndpointProfileType { get; set; } + /// Defines the client authentication mechanism to the server. + public DeviceRegistryAuthentication Authentication { get; set; } + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + public string AdditionalConfiguration { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetListResult.Serialization.cs index 422f4d0eabcb..4f6383435b96 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetListResult.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetListResult.Serialization.cs @@ -41,7 +41,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteObjectValue(item, options); } writer.WriteEndArray(); - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.Serialization.cs new file mode 100644 index 000000000000..36963554776d --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.Serialization.cs @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class AssetProperties : 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(AssetProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (Optional.IsDefined(ExternalAssetId)) + { + writer.WritePropertyName("externalAssetId"u8); + writer.WriteStringValue(ExternalAssetId); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("assetEndpointProfileRef"u8); + writer.WriteStringValue(AssetEndpointProfileRef); + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (Optional.IsDefined(Manufacturer)) + { + writer.WritePropertyName("manufacturer"u8); + writer.WriteStringValue(Manufacturer); + } + if (Optional.IsDefined(ManufacturerUri)) + { + writer.WritePropertyName("manufacturerUri"u8); + writer.WriteStringValue(ManufacturerUri.AbsoluteUri); + } + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + } + if (Optional.IsDefined(ProductCode)) + { + writer.WritePropertyName("productCode"u8); + writer.WriteStringValue(ProductCode); + } + if (Optional.IsDefined(HardwareRevision)) + { + writer.WritePropertyName("hardwareRevision"u8); + writer.WriteStringValue(HardwareRevision); + } + if (Optional.IsDefined(SoftwareRevision)) + { + writer.WritePropertyName("softwareRevision"u8); + writer.WriteStringValue(SoftwareRevision); + } + if (Optional.IsDefined(DocumentationUri)) + { + writer.WritePropertyName("documentationUri"u8); + writer.WriteStringValue(DocumentationUri.AbsoluteUri); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartObject(); + foreach (var item in Attributes) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(DiscoveredAssetRefs)) + { + writer.WritePropertyName("discoveredAssetRefs"u8); + writer.WriteStartArray(); + foreach (var item in DiscoveredAssetRefs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DefaultDatasetsConfiguration)) + { + writer.WritePropertyName("defaultDatasetsConfiguration"u8); + writer.WriteStringValue(DefaultDatasetsConfiguration); + } + if (Optional.IsDefined(DefaultEventsConfiguration)) + { + writer.WritePropertyName("defaultEventsConfiguration"u8); + writer.WriteStringValue(DefaultEventsConfiguration); + } + if (Optional.IsDefined(DefaultTopic)) + { + writer.WritePropertyName("defaultTopic"u8); + writer.WriteObjectValue(DefaultTopic, options); + } + if (Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (var item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AssetProperties 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(AssetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetProperties(document.RootElement, options); + } + + internal static AssetProperties DeserializeAssetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uuid = default; + bool? enabled = default; + string externalAssetId = default; + string displayName = default; + string description = default; + string assetEndpointProfileRef = default; + long? version = default; + string manufacturer = default; + Uri manufacturerUri = default; + string model = default; + string productCode = default; + string hardwareRevision = default; + string softwareRevision = default; + Uri documentationUri = default; + string serialNumber = default; + IDictionary attributes = default; + IList discoveredAssetRefs = default; + string defaultDatasetsConfiguration = default; + string defaultEventsConfiguration = default; + DeviceRegistryTopic defaultTopic = default; + IList datasets = default; + IList events = default; + DeviceRegistryAssetStatus status = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("externalAssetId"u8)) + { + externalAssetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("assetEndpointProfileRef"u8)) + { + assetEndpointProfileRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("manufacturer"u8)) + { + manufacturer = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturerUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + manufacturerUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("productCode"u8)) + { + productCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("hardwareRevision"u8)) + { + hardwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("softwareRevision"u8)) + { + softwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("documentationUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + attributes = dictionary; + continue; + } + if (property.NameEquals("discoveredAssetRefs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + discoveredAssetRefs = array; + continue; + } + if (property.NameEquals("defaultDatasetsConfiguration"u8)) + { + defaultDatasetsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultEventsConfiguration"u8)) + { + defaultEventsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTopic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultTopic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryDataset.DeserializeDeviceRegistryDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryEvent.DeserializeDeviceRegistryEvent(item, options)); + } + events = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = DeviceRegistryAssetStatus.DeserializeDeviceRegistryAssetStatus(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetProperties( + uuid, + enabled, + externalAssetId, + displayName, + description, + assetEndpointProfileRef, + version, + manufacturer, + manufacturerUri, + model, + productCode, + hardwareRevision, + softwareRevision, + documentationUri, + serialNumber, + attributes ?? new ChangeTrackingDictionary(), + discoveredAssetRefs ?? new ChangeTrackingList(), + defaultDatasetsConfiguration, + defaultEventsConfiguration, + defaultTopic, + datasets ?? new ChangeTrackingList(), + events ?? new ChangeTrackingList(), + status, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetProperties)} does not support writing '{options.Format}' format."); + } + } + + AssetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.cs new file mode 100644 index 000000000000..669a5651b199 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetProperties.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the asset properties. + public partial class AssetProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + /// is null. + public AssetProperties(string assetEndpointProfileRef) + { + Argument.AssertNotNull(assetEndpointProfileRef, nameof(assetEndpointProfileRef)); + + AssetEndpointProfileRef = assetEndpointProfileRef; + Attributes = new ChangeTrackingDictionary(); + DiscoveredAssetRefs = new ChangeTrackingList(); + Datasets = new ChangeTrackingList(); + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Enabled/Disabled status of the asset. + /// Asset id provided by the customer. + /// Human-readable display name. + /// Human-readable description of the asset. + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + /// An integer that is incremented each time the resource is modified. + /// Asset manufacturer name. + /// Asset manufacturer URI. + /// Asset model name. + /// Asset product code. + /// Revision number of the hardware. + /// Revision number of the software. + /// Reference to the documentation. + /// Asset serial number. + /// A set of key-value pairs that contain custom attributes set by the customer. + /// Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered asset names must be provided. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. + /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal AssetProperties(string uuid, bool? isEnabled, string externalAssetId, string displayName, string description, string assetEndpointProfileRef, long? version, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, IDictionary attributes, IList discoveredAssetRefs, string defaultDatasetsConfiguration, string defaultEventsConfiguration, DeviceRegistryTopic defaultTopic, IList datasets, IList events, DeviceRegistryAssetStatus status, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Uuid = uuid; + IsEnabled = isEnabled; + ExternalAssetId = externalAssetId; + DisplayName = displayName; + Description = description; + AssetEndpointProfileRef = assetEndpointProfileRef; + Version = version; + Manufacturer = manufacturer; + ManufacturerUri = manufacturerUri; + Model = model; + ProductCode = productCode; + HardwareRevision = hardwareRevision; + SoftwareRevision = softwareRevision; + DocumentationUri = documentationUri; + SerialNumber = serialNumber; + Attributes = attributes; + DiscoveredAssetRefs = discoveredAssetRefs; + DefaultDatasetsConfiguration = defaultDatasetsConfiguration; + DefaultEventsConfiguration = defaultEventsConfiguration; + DefaultTopic = defaultTopic; + Datasets = datasets; + Events = events; + Status = status; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssetProperties() + { + } + + /// Globally unique, immutable, non-reusable id. + public string Uuid { get; } + /// Enabled/Disabled status of the asset. + public bool? IsEnabled { get; set; } + /// Asset id provided by the customer. + public string ExternalAssetId { get; set; } + /// Human-readable display name. + public string DisplayName { get; set; } + /// Human-readable description of the asset. + public string Description { get; set; } + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + public string AssetEndpointProfileRef { get; set; } + /// An integer that is incremented each time the resource is modified. + public long? Version { get; } + /// Asset manufacturer name. + public string Manufacturer { get; set; } + /// Asset manufacturer URI. + public Uri ManufacturerUri { get; set; } + /// Asset model name. + public string Model { get; set; } + /// Asset product code. + public string ProductCode { get; set; } + /// Revision number of the hardware. + public string HardwareRevision { get; set; } + /// Revision number of the software. + public string SoftwareRevision { get; set; } + /// Reference to the documentation. + public Uri DocumentationUri { get; set; } + /// Asset serial number. + public string SerialNumber { get; set; } + /// + /// A set of key-value pairs that contain custom attributes set by the customer. + /// + /// 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" }. + /// + /// + /// + /// + public IDictionary Attributes { get; } + /// Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered asset names must be provided. + public IList DiscoveredAssetRefs { get; } + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + public string DefaultDatasetsConfiguration { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + public string DefaultEventsConfiguration { get; set; } + /// Object that describes the default topic information for the asset. + public DeviceRegistryTopic DefaultTopic { get; set; } + /// Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + public IList Datasets { get; } + /// Array of events that are part of the asset. Each event can have per-event configuration. + public IList Events { get; } + /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. + public DeviceRegistryAssetStatus Status { get; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..6f0e454b4f42 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.Serialization.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class AssetUpdateProperties : 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(AssetUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Manufacturer)) + { + writer.WritePropertyName("manufacturer"u8); + writer.WriteStringValue(Manufacturer); + } + if (Optional.IsDefined(ManufacturerUri)) + { + writer.WritePropertyName("manufacturerUri"u8); + writer.WriteStringValue(ManufacturerUri.AbsoluteUri); + } + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + } + if (Optional.IsDefined(ProductCode)) + { + writer.WritePropertyName("productCode"u8); + writer.WriteStringValue(ProductCode); + } + if (Optional.IsDefined(HardwareRevision)) + { + writer.WritePropertyName("hardwareRevision"u8); + writer.WriteStringValue(HardwareRevision); + } + if (Optional.IsDefined(SoftwareRevision)) + { + writer.WritePropertyName("softwareRevision"u8); + writer.WriteStringValue(SoftwareRevision); + } + if (Optional.IsDefined(DocumentationUri)) + { + writer.WritePropertyName("documentationUri"u8); + writer.WriteStringValue(DocumentationUri.AbsoluteUri); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartObject(); + foreach (var item in Attributes) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(DefaultDatasetsConfiguration)) + { + writer.WritePropertyName("defaultDatasetsConfiguration"u8); + writer.WriteStringValue(DefaultDatasetsConfiguration); + } + if (Optional.IsDefined(DefaultEventsConfiguration)) + { + writer.WritePropertyName("defaultEventsConfiguration"u8); + writer.WriteStringValue(DefaultEventsConfiguration); + } + if (Optional.IsDefined(DefaultTopic)) + { + writer.WritePropertyName("defaultTopic"u8); + writer.WriteObjectValue(DefaultTopic, options); + } + if (Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (var item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AssetUpdateProperties 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(AssetUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetUpdateProperties(document.RootElement, options); + } + + internal static AssetUpdateProperties DeserializeAssetUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + string displayName = default; + string description = default; + string manufacturer = default; + Uri manufacturerUri = default; + string model = default; + string productCode = default; + string hardwareRevision = default; + string softwareRevision = default; + Uri documentationUri = default; + string serialNumber = default; + IDictionary attributes = default; + string defaultDatasetsConfiguration = default; + string defaultEventsConfiguration = default; + DeviceRegistryTopic defaultTopic = default; + IList datasets = default; + IList events = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturer"u8)) + { + manufacturer = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturerUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + manufacturerUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("productCode"u8)) + { + productCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("hardwareRevision"u8)) + { + hardwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("softwareRevision"u8)) + { + softwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("documentationUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + attributes = dictionary; + continue; + } + if (property.NameEquals("defaultDatasetsConfiguration"u8)) + { + defaultDatasetsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultEventsConfiguration"u8)) + { + defaultEventsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTopic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultTopic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryDataset.DeserializeDeviceRegistryDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryEvent.DeserializeDeviceRegistryEvent(item, options)); + } + events = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetUpdateProperties( + enabled, + displayName, + description, + manufacturer, + manufacturerUri, + model, + productCode, + hardwareRevision, + softwareRevision, + documentationUri, + serialNumber, + attributes ?? new ChangeTrackingDictionary(), + defaultDatasetsConfiguration, + defaultEventsConfiguration, + defaultTopic, + datasets ?? new ChangeTrackingList(), + events ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AssetUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.cs new file mode 100644 index 000000000000..7decd6bf9e4d --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetUpdateProperties.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The updatable properties of the Asset. + public partial class AssetUpdateProperties + { + /// + /// 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 AssetUpdateProperties() + { + Attributes = new ChangeTrackingDictionary(); + Datasets = new ChangeTrackingList(); + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enabled/Disabled status of the asset. + /// Human-readable display name. + /// Human-readable description of the asset. + /// Asset manufacturer name. + /// Asset manufacturer URI. + /// Asset model name. + /// Asset product code. + /// Revision number of the hardware. + /// Revision number of the software. + /// Reference to the documentation. + /// Asset serial number. + /// A set of key-value pairs that contain custom attributes set by the customer. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. + /// Keeps track of any properties unknown to the library. + internal AssetUpdateProperties(bool? isEnabled, string displayName, string description, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, IDictionary attributes, string defaultDatasetsConfiguration, string defaultEventsConfiguration, DeviceRegistryTopic defaultTopic, IList datasets, IList events, IDictionary serializedAdditionalRawData) + { + IsEnabled = isEnabled; + DisplayName = displayName; + Description = description; + Manufacturer = manufacturer; + ManufacturerUri = manufacturerUri; + Model = model; + ProductCode = productCode; + HardwareRevision = hardwareRevision; + SoftwareRevision = softwareRevision; + DocumentationUri = documentationUri; + SerialNumber = serialNumber; + Attributes = attributes; + DefaultDatasetsConfiguration = defaultDatasetsConfiguration; + DefaultEventsConfiguration = defaultEventsConfiguration; + DefaultTopic = defaultTopic; + Datasets = datasets; + Events = events; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enabled/Disabled status of the asset. + public bool? IsEnabled { get; set; } + /// Human-readable display name. + public string DisplayName { get; set; } + /// Human-readable description of the asset. + public string Description { get; set; } + /// Asset manufacturer name. + public string Manufacturer { get; set; } + /// Asset manufacturer URI. + public Uri ManufacturerUri { get; set; } + /// Asset model name. + public string Model { get; set; } + /// Asset product code. + public string ProductCode { get; set; } + /// Revision number of the hardware. + public string HardwareRevision { get; set; } + /// Revision number of the software. + public string SoftwareRevision { get; set; } + /// Reference to the documentation. + public Uri DocumentationUri { get; set; } + /// Asset serial number. + public string SerialNumber { get; set; } + /// + /// A set of key-value pairs that contain custom attributes set by the customer. + /// + /// 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" }. + /// + /// + /// + /// + public IDictionary Attributes { get; } + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + public string DefaultDatasetsConfiguration { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + public string DefaultEventsConfiguration { get; set; } + /// Object that describes the default topic information for the asset. + public DeviceRegistryTopic DefaultTopic { get; set; } + /// Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + public IList Datasets { get; } + /// Array of events that are part of the asset. Each event can have per-event configuration. + public IList Events { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AuthenticationMethod.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AuthenticationMethod.cs new file mode 100644 index 000000000000..510d66a6e78a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AuthenticationMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The method to authenticate the user of the client at the server. + public readonly partial struct AuthenticationMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthenticationMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AnonymousValue = "Anonymous"; + private const string CertificateValue = "Certificate"; + private const string UsernamePasswordValue = "UsernamePassword"; + + /// The user authentication method is anonymous. + public static AuthenticationMethod Anonymous { get; } = new AuthenticationMethod(AnonymousValue); + /// The user authentication method is an x509 certificate. + public static AuthenticationMethod Certificate { get; } = new AuthenticationMethod(CertificateValue); + /// The user authentication method is a username and password. + public static AuthenticationMethod UsernamePassword { get; } = new AuthenticationMethod(UsernamePasswordValue); + /// Determines if two values are the same. + public static bool operator ==(AuthenticationMethod left, AuthenticationMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthenticationMethod left, AuthenticationMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthenticationMethod(string value) => new AuthenticationMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthenticationMethod other && Equals(other); + /// + public bool Equals(AuthenticationMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.Serialization.cs new file mode 100644 index 000000000000..68308896cc1b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + internal partial class BillingContainerListResult : 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(BillingContainerListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BillingContainerListResult 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(BillingContainerListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBillingContainerListResult(document.RootElement, options); + } + + internal static BillingContainerListResult DeserializeBillingContainerListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryBillingContainerData.DeserializeDeviceRegistryBillingContainerData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BillingContainerListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BillingContainerListResult)} does not support writing '{options.Format}' format."); + } + } + + BillingContainerListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBillingContainerListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BillingContainerListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.cs new file mode 100644 index 000000000000..2743f53f25e0 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The response of a BillingContainer list operation. + internal partial class BillingContainerListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The BillingContainer items on this page. + /// is null. + internal BillingContainerListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The BillingContainer items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BillingContainerListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingContainerListResult() + { + } + + /// The BillingContainer items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.Serialization.cs similarity index 54% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.Serialization.cs index d3efc32329bb..6b2389fd396f 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - internal partial class X509CredentialsUpdate : IUtf8JsonSerializable, IJsonModel + internal partial class BillingContainerProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(X509CredentialsUpdate)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(BillingContainerProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(CertificateReference)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { - writer.WritePropertyName("certificateReference"u8); - writer.WriteStringValue(CertificateReference); + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - X509CredentialsUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + BillingContainerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(X509CredentialsUpdate)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(BillingContainerProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeX509CredentialsUpdate(document.RootElement, options); + return DeserializeBillingContainerProperties(document.RootElement, options); } - internal static X509CredentialsUpdate DeserializeX509CredentialsUpdate(JsonElement element, ModelReaderWriterOptions options = null) + internal static BillingContainerProperties DeserializeBillingContainerProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,14 +76,18 @@ internal static X509CredentialsUpdate DeserializeX509CredentialsUpdate(JsonEleme { return null; } - string certificateReference = default; + DeviceRegistryProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("certificateReference"u8)) + if (property.NameEquals("provisioningState"u8)) { - certificateReference = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); continue; } if (options.Format != "W") @@ -92,38 +96,38 @@ internal static X509CredentialsUpdate DeserializeX509CredentialsUpdate(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new X509CredentialsUpdate(certificateReference, serializedAdditionalRawData); + return new BillingContainerProperties(provisioningState, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(X509CredentialsUpdate)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingContainerProperties)} does not support writing '{options.Format}' format."); } } - X509CredentialsUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + BillingContainerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeX509CredentialsUpdate(document.RootElement, options); + return DeserializeBillingContainerProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(X509CredentialsUpdate)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingContainerProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.cs similarity index 66% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.cs index fd94448bc61f..65c77d98627d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509CredentialsUpdate.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/BillingContainerProperties.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - /// The x509 certificate for authentication mode Certificate. - internal partial class X509CredentialsUpdate + /// Defines the billingContainer properties. + internal partial class BillingContainerProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ internal partial class X509CredentialsUpdate /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public X509CredentialsUpdate() + /// Initializes a new instance of . + internal BillingContainerProperties() { } - /// Initializes a new instance of . - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + /// Initializes a new instance of . + /// Provisioning state of the resource. /// Keeps track of any properties unknown to the library. - internal X509CredentialsUpdate(string certificateReference, IDictionary serializedAdditionalRawData) + internal BillingContainerProperties(DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) { - CertificateReference = certificateReference; + ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - public string CertificateReference { get; set; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointObservabilityMode.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointObservabilityMode.cs new file mode 100644 index 000000000000..cc083a56a6c9 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointObservabilityMode.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the data point observability mode. + public readonly partial struct DataPointObservabilityMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataPointObservabilityMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string CounterValue = "Counter"; + private const string GaugeValue = "Gauge"; + private const string HistogramValue = "Histogram"; + private const string LogValue = "Log"; + + /// No mapping to OpenTelemetry. + public static DataPointObservabilityMode None { get; } = new DataPointObservabilityMode(NoneValue); + /// Map as counter to OpenTelemetry. + public static DataPointObservabilityMode Counter { get; } = new DataPointObservabilityMode(CounterValue); + /// Map as gauge to OpenTelemetry. + public static DataPointObservabilityMode Gauge { get; } = new DataPointObservabilityMode(GaugeValue); + /// Map as histogram to OpenTelemetry. + public static DataPointObservabilityMode Histogram { get; } = new DataPointObservabilityMode(HistogramValue); + /// Map as log to OpenTelemetry. + public static DataPointObservabilityMode Log { get; } = new DataPointObservabilityMode(LogValue); + /// Determines if two values are the same. + public static bool operator ==(DataPointObservabilityMode left, DataPointObservabilityMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataPointObservabilityMode left, DataPointObservabilityMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataPointObservabilityMode(string value) => new DataPointObservabilityMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataPointObservabilityMode other && Equals(other); + /// + public bool Equals(DataPointObservabilityMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointsObservabilityMode.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointsObservabilityMode.cs deleted file mode 100644 index d270b2a15267..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPointsObservabilityMode.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - /// An indication of how the data point should be mapped to OpenTelemetry. - public readonly partial struct DataPointsObservabilityMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DataPointsObservabilityMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "none"; - private const string CounterValue = "counter"; - private const string GaugeValue = "gauge"; - private const string HistogramValue = "histogram"; - private const string LogValue = "log"; - - /// No mapping to OpenTelemetry. - public static DataPointsObservabilityMode None { get; } = new DataPointsObservabilityMode(NoneValue); - /// Map as counter to OpenTelemetry. - public static DataPointsObservabilityMode Counter { get; } = new DataPointsObservabilityMode(CounterValue); - /// Map as gauge to OpenTelemetry. - public static DataPointsObservabilityMode Gauge { get; } = new DataPointsObservabilityMode(GaugeValue); - /// Map as histogram to OpenTelemetry. - public static DataPointsObservabilityMode Histogram { get; } = new DataPointsObservabilityMode(HistogramValue); - /// Map as log to OpenTelemetry. - public static DataPointsObservabilityMode Log { get; } = new DataPointsObservabilityMode(LogValue); - /// Determines if two values are the same. - public static bool operator ==(DataPointsObservabilityMode left, DataPointsObservabilityMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DataPointsObservabilityMode left, DataPointsObservabilityMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DataPointsObservabilityMode(string value) => new DataPointsObservabilityMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DataPointsObservabilityMode other && Equals(other); - /// - public bool Equals(DataPointsObservabilityMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.Serialization.cs index 03429cf9ff29..3539d91da4a8 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.Serialization.cs @@ -45,29 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(TargetAddress)) - { - writer.WritePropertyName("targetAddress"u8); - writer.WriteStringValue(TargetAddress.AbsoluteUri); - } - if (Optional.IsDefined(UserAuthentication)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("userAuthentication"u8); - writer.WriteObjectValue(UserAuthentication, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(TransportAuthentication)) - { - writer.WritePropertyName("transportAuthentication"u8); - writer.WriteObjectValue(TransportAuthentication, options); - } - if (Optional.IsDefined(AdditionalConfiguration)) - { - writer.WritePropertyName("additionalConfiguration"u8); - writer.WriteStringValue(AdditionalConfiguration); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -106,10 +88,7 @@ internal static DeviceRegistryAssetEndpointProfilePatch DeserializeDeviceRegistr return null; } IDictionary tags = default; - Uri targetAddress = default; - UserAuthenticationUpdate userAuthentication = default; - TransportAuthenticationUpdate transportAuthentication = default; - string additionalConfiguration = default; + AssetEndpointProfileUpdateProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -132,44 +111,9 @@ internal static DeviceRegistryAssetEndpointProfilePatch DeserializeDeviceRegistr { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("targetAddress"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - targetAddress = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("userAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - userAuthentication = UserAuthenticationUpdate.DeserializeUserAuthenticationUpdate(property0.Value, options); - continue; - } - if (property0.NameEquals("transportAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - transportAuthentication = TransportAuthenticationUpdate.DeserializeTransportAuthenticationUpdate(property0.Value, options); - continue; - } - if (property0.NameEquals("additionalConfiguration"u8)) - { - additionalConfiguration = property0.Value.GetString(); - continue; - } - } + properties = AssetEndpointProfileUpdateProperties.DeserializeAssetEndpointProfileUpdateProperties(property.Value, options); continue; } if (options.Format != "W") @@ -178,13 +122,7 @@ internal static DeviceRegistryAssetEndpointProfilePatch DeserializeDeviceRegistr } } serializedAdditionalRawData = rawDataDictionary; - return new DeviceRegistryAssetEndpointProfilePatch( - tags ?? new ChangeTrackingDictionary(), - targetAddress, - userAuthentication, - transportAuthentication, - additionalConfiguration, - serializedAdditionalRawData); + return new DeviceRegistryAssetEndpointProfilePatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.cs index d3c9cc57db1c..40fd9d1161dd 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfilePatch.cs @@ -53,41 +53,18 @@ public DeviceRegistryAssetEndpointProfilePatch() /// Initializes a new instance of . /// Resource tags. - /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. - /// Defines the client authentication mechanism to the server. - /// Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - /// Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal DeviceRegistryAssetEndpointProfilePatch(IDictionary tags, Uri targetAddress, UserAuthenticationUpdate userAuthentication, TransportAuthenticationUpdate transportAuthentication, string additionalConfiguration, IDictionary serializedAdditionalRawData) + internal DeviceRegistryAssetEndpointProfilePatch(IDictionary tags, AssetEndpointProfileUpdateProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; - TargetAddress = targetAddress; - UserAuthentication = userAuthentication; - TransportAuthentication = transportAuthentication; - AdditionalConfiguration = additionalConfiguration; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource tags. public IDictionary Tags { get; } - /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. - public Uri TargetAddress { get; set; } - /// Defines the client authentication mechanism to the server. - public UserAuthenticationUpdate UserAuthentication { get; set; } - /// Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - internal TransportAuthenticationUpdate TransportAuthentication { get; set; } - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - public IList TransportAuthenticationOwnCertificates - { - get - { - if (TransportAuthentication is null) - TransportAuthentication = new TransportAuthenticationUpdate(); - return TransportAuthentication.OwnCertificates; - } - } - - /// Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). - public string AdditionalConfiguration { get; set; } + /// The resource-specific properties for this resource. + public AssetEndpointProfileUpdateProperties Properties { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.Serialization.cs new file mode 100644 index 000000000000..22a2c8b816ea --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.Serialization.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryAssetEndpointProfileProperties : 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(DeviceRegistryAssetEndpointProfileProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + writer.WritePropertyName("targetAddress"u8); + writer.WriteStringValue(TargetAddress.AbsoluteUri); + writer.WritePropertyName("endpointProfileType"u8); + writer.WriteStringValue(EndpointProfileType); + if (Optional.IsDefined(Authentication)) + { + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + } + if (Optional.IsDefined(AdditionalConfiguration)) + { + writer.WritePropertyName("additionalConfiguration"u8); + writer.WriteStringValue(AdditionalConfiguration); + } + if (Optional.IsDefined(DiscoveredAssetEndpointProfileRef)) + { + writer.WritePropertyName("discoveredAssetEndpointProfileRef"u8); + writer.WriteStringValue(DiscoveredAssetEndpointProfileRef); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryAssetEndpointProfileProperties 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(DeviceRegistryAssetEndpointProfileProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryAssetEndpointProfileProperties(document.RootElement, options); + } + + internal static DeviceRegistryAssetEndpointProfileProperties DeserializeDeviceRegistryAssetEndpointProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uuid = default; + Uri targetAddress = default; + string endpointProfileType = default; + DeviceRegistryAuthentication authentication = default; + string additionalConfiguration = default; + string discoveredAssetEndpointProfileRef = default; + AssetEndpointProfileStatus status = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetAddress"u8)) + { + targetAddress = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpointProfileType"u8)) + { + endpointProfileType = property.Value.GetString(); + continue; + } + if (property.NameEquals("authentication"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authentication = DeviceRegistryAuthentication.DeserializeDeviceRegistryAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("additionalConfiguration"u8)) + { + additionalConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("discoveredAssetEndpointProfileRef"u8)) + { + discoveredAssetEndpointProfileRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = AssetEndpointProfileStatus.DeserializeAssetEndpointProfileStatus(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryAssetEndpointProfileProperties( + uuid, + targetAddress, + endpointProfileType, + authentication, + additionalConfiguration, + discoveredAssetEndpointProfileRef, + status, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetEndpointProfileProperties)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryAssetEndpointProfileProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryAssetEndpointProfileProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetEndpointProfileProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.cs new file mode 100644 index 000000000000..95c368849b4b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetEndpointProfileProperties.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the Asset Endpoint Profile properties. + public partial class DeviceRegistryAssetEndpointProfileProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// or is null. + public DeviceRegistryAssetEndpointProfileProperties(Uri targetAddress, string endpointProfileType) + { + Argument.AssertNotNull(targetAddress, nameof(targetAddress)); + Argument.AssertNotNull(endpointProfileType, nameof(endpointProfileType)); + + TargetAddress = targetAddress; + EndpointProfileType = endpointProfileType; + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Defines the client authentication mechanism to the server. + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// Reference to a discovered asset endpoint profile. Populated only if the asset endpoint profile has been created from discovery flow. Discovered asset endpoint profile name must be provided. + /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryAssetEndpointProfileProperties(string uuid, Uri targetAddress, string endpointProfileType, DeviceRegistryAuthentication authentication, string additionalConfiguration, string discoveredAssetEndpointProfileRef, AssetEndpointProfileStatus status, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Uuid = uuid; + TargetAddress = targetAddress; + EndpointProfileType = endpointProfileType; + Authentication = authentication; + AdditionalConfiguration = additionalConfiguration; + DiscoveredAssetEndpointProfileRef = discoveredAssetEndpointProfileRef; + Status = status; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryAssetEndpointProfileProperties() + { + } + + /// Globally unique, immutable, non-reusable id. + public string Uuid { get; } + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + public Uri TargetAddress { get; set; } + /// Defines the configuration for the connector type that is being used with the endpoint profile. + public string EndpointProfileType { get; set; } + /// Defines the client authentication mechanism to the server. + public DeviceRegistryAuthentication Authentication { get; set; } + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + public string AdditionalConfiguration { get; set; } + /// Reference to a discovered asset endpoint profile. Populated only if the asset endpoint profile has been created from discovery flow. Discovered asset endpoint profile name must be provided. + public string DiscoveredAssetEndpointProfileRef { get; set; } + /// Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. + internal AssetEndpointProfileStatus Status { get; } + /// Array object to transfer and persist errors that originate from the Edge. + public IReadOnlyList StatusErrors + { + get => Status?.Errors; + } + + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.Serialization.cs index 1ad488271362..d443863ebcf6 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.Serialization.cs @@ -45,122 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(AssetType)) - { - writer.WritePropertyName("assetType"u8); - writer.WriteStringValue(AssetType); - } - if (Optional.IsDefined(Enabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(Enabled.Value); - } - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(Manufacturer)) - { - writer.WritePropertyName("manufacturer"u8); - writer.WriteStringValue(Manufacturer); - } - if (Optional.IsDefined(ManufacturerUri)) - { - writer.WritePropertyName("manufacturerUri"u8); - writer.WriteStringValue(ManufacturerUri.AbsoluteUri); - } - if (Optional.IsDefined(Model)) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(Model); - } - if (Optional.IsDefined(ProductCode)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("productCode"u8); - writer.WriteStringValue(ProductCode); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(HardwareRevision)) - { - writer.WritePropertyName("hardwareRevision"u8); - writer.WriteStringValue(HardwareRevision); - } - if (Optional.IsDefined(SoftwareRevision)) - { - writer.WritePropertyName("softwareRevision"u8); - writer.WriteStringValue(SoftwareRevision); - } - if (Optional.IsDefined(DocumentationUri)) - { - writer.WritePropertyName("documentationUri"u8); - writer.WriteStringValue(DocumentationUri.AbsoluteUri); - } - if (Optional.IsDefined(SerialNumber)) - { - writer.WritePropertyName("serialNumber"u8); - writer.WriteStringValue(SerialNumber); - } - if (Optional.IsCollectionDefined(Attributes)) - { - writer.WritePropertyName("attributes"u8); - writer.WriteStartObject(); - foreach (var item in Attributes) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(DefaultDataPointsConfiguration)) - { - writer.WritePropertyName("defaultDataPointsConfiguration"u8); - writer.WriteStringValue(DefaultDataPointsConfiguration); - } - if (Optional.IsDefined(DefaultEventsConfiguration)) - { - writer.WritePropertyName("defaultEventsConfiguration"u8); - writer.WriteStringValue(DefaultEventsConfiguration); - } - if (Optional.IsCollectionDefined(DataPoints)) - { - writer.WritePropertyName("dataPoints"u8); - writer.WriteStartArray(); - foreach (var item in DataPoints) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(Events)) - { - writer.WritePropertyName("events"u8); - writer.WriteStartArray(); - foreach (var item in Events) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -199,23 +88,7 @@ internal static DeviceRegistryAssetPatch DeserializeDeviceRegistryAssetPatch(Jso return null; } IDictionary tags = default; - string assetType = default; - bool? enabled = default; - string displayName = default; - string description = default; - string manufacturer = default; - Uri manufacturerUri = default; - string model = default; - string productCode = default; - string hardwareRevision = default; - string softwareRevision = default; - Uri documentationUri = default; - string serialNumber = default; - IDictionary attributes = default; - string defaultDataPointsConfiguration = default; - string defaultEventsConfiguration = default; - IList dataPoints = default; - IList events = default; + AssetUpdateProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -238,143 +111,9 @@ internal static DeviceRegistryAssetPatch DeserializeDeviceRegistryAssetPatch(Jso { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("assetType"u8)) - { - assetType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("manufacturer"u8)) - { - manufacturer = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("manufacturerUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - manufacturerUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("model"u8)) - { - model = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("productCode"u8)) - { - productCode = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("hardwareRevision"u8)) - { - hardwareRevision = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("softwareRevision"u8)) - { - softwareRevision = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("documentationUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - documentationUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("serialNumber"u8)) - { - serialNumber = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("attributes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - if (property1.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property1.Name, null); - } - else - { - dictionary.Add(property1.Name, BinaryData.FromString(property1.Value.GetRawText())); - } - } - attributes = dictionary; - continue; - } - if (property0.NameEquals("defaultDataPointsConfiguration"u8)) - { - defaultDataPointsConfiguration = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("defaultEventsConfiguration"u8)) - { - defaultEventsConfiguration = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataPoints"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DataPoint.DeserializeDataPoint(item, options)); - } - dataPoints = array; - continue; - } - if (property0.NameEquals("events"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AssetEvent.DeserializeAssetEvent(item, options)); - } - events = array; - continue; - } - } + properties = AssetUpdateProperties.DeserializeAssetUpdateProperties(property.Value, options); continue; } if (options.Format != "W") @@ -383,26 +122,7 @@ internal static DeviceRegistryAssetPatch DeserializeDeviceRegistryAssetPatch(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new DeviceRegistryAssetPatch( - tags ?? new ChangeTrackingDictionary(), - assetType, - enabled, - displayName, - description, - manufacturer, - manufacturerUri, - model, - productCode, - hardwareRevision, - softwareRevision, - documentationUri, - serialNumber, - attributes ?? new ChangeTrackingDictionary(), - defaultDataPointsConfiguration, - defaultEventsConfiguration, - dataPoints ?? new ChangeTrackingList(), - events ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new DeviceRegistryAssetPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.cs index f7415ffe242d..9dd9551f120d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetPatch.cs @@ -49,118 +49,22 @@ public partial class DeviceRegistryAssetPatch public DeviceRegistryAssetPatch() { Tags = new ChangeTrackingDictionary(); - Attributes = new ChangeTrackingDictionary(); - DataPoints = new ChangeTrackingList(); - Events = new ChangeTrackingList(); } /// Initializes a new instance of . /// Resource tags. - /// Resource path to asset type (model) definition. - /// Enabled/Disabled status of the asset. - /// Human-readable display name. - /// Human-readable description of the asset. - /// Asset manufacturer name. - /// Asset manufacturer URI. - /// Asset model name. - /// Asset product code. - /// Revision number of the hardware. - /// Revision number of the software. - /// Reference to the documentation. - /// Asset serial number. - /// A set of key-value pairs that contain custom attributes set by the customer. - /// Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - /// Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. - /// Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal DeviceRegistryAssetPatch(IDictionary tags, string assetType, bool? enabled, string displayName, string description, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, IDictionary attributes, string defaultDataPointsConfiguration, string defaultEventsConfiguration, IList dataPoints, IList events, IDictionary serializedAdditionalRawData) + internal DeviceRegistryAssetPatch(IDictionary tags, AssetUpdateProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; - AssetType = assetType; - Enabled = enabled; - DisplayName = displayName; - Description = description; - Manufacturer = manufacturer; - ManufacturerUri = manufacturerUri; - Model = model; - ProductCode = productCode; - HardwareRevision = hardwareRevision; - SoftwareRevision = softwareRevision; - DocumentationUri = documentationUri; - SerialNumber = serialNumber; - Attributes = attributes; - DefaultDataPointsConfiguration = defaultDataPointsConfiguration; - DefaultEventsConfiguration = defaultEventsConfiguration; - DataPoints = dataPoints; - Events = events; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource tags. public IDictionary Tags { get; } - /// Resource path to asset type (model) definition. - public string AssetType { get; set; } - /// Enabled/Disabled status of the asset. - public bool? Enabled { get; set; } - /// Human-readable display name. - public string DisplayName { get; set; } - /// Human-readable description of the asset. - public string Description { get; set; } - /// Asset manufacturer name. - public string Manufacturer { get; set; } - /// Asset manufacturer URI. - public Uri ManufacturerUri { get; set; } - /// Asset model name. - public string Model { get; set; } - /// Asset product code. - public string ProductCode { get; set; } - /// Revision number of the hardware. - public string HardwareRevision { get; set; } - /// Revision number of the software. - public string SoftwareRevision { get; set; } - /// Reference to the documentation. - public Uri DocumentationUri { get; set; } - /// Asset serial number. - public string SerialNumber { get; set; } - /// - /// A set of key-value pairs that contain custom attributes set by the customer. - /// - /// 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" }. - /// - /// - /// - /// - public IDictionary Attributes { get; } - /// Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - public string DefaultDataPointsConfiguration { get; set; } - /// Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. - public string DefaultEventsConfiguration { get; set; } - /// Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. - public IList DataPoints { get; } - /// Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. - public IList Events { get; } + /// The resource-specific properties for this resource. + public AssetUpdateProperties Properties { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.Serialization.cs new file mode 100644 index 000000000000..73042cc2f4a8 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.Serialization.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryAssetStatus : 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(DeviceRegistryAssetStatus)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (var item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryAssetStatus 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(DeviceRegistryAssetStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryAssetStatus(document.RootElement, options); + } + + internal static DeviceRegistryAssetStatus DeserializeDeviceRegistryAssetStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + long? version = default; + IReadOnlyList datasets = default; + IReadOnlyList events = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryAssetStatusError.DeserializeDeviceRegistryAssetStatusError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryAssetStatusDataset.DeserializeDeviceRegistryAssetStatusDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryAssetStatusEvent.DeserializeDeviceRegistryAssetStatusEvent(item, options)); + } + events = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryAssetStatus(errors ?? new ChangeTrackingList(), version, datasets ?? new ChangeTrackingList(), events ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatus)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryAssetStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryAssetStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.cs new file mode 100644 index 000000000000..608492bab244 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatus.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the asset status properties. + public partial class DeviceRegistryAssetStatus + { + /// + /// 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 DeviceRegistryAssetStatus() + { + Errors = new ChangeTrackingList(); + Datasets = new ChangeTrackingList(); + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array object to transfer and persist errors that originate from the Edge. + /// A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. + /// Array of dataset statuses that describe the status of each dataset. + /// Array of event statuses that describe the status of each event. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryAssetStatus(IReadOnlyList errors, long? version, IReadOnlyList datasets, IReadOnlyList events, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Version = version; + Datasets = datasets; + Events = events; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Array object to transfer and persist errors that originate from the Edge. + public IReadOnlyList Errors { get; } + /// A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. + public long? Version { get; } + /// Array of dataset statuses that describe the status of each dataset. + public IReadOnlyList Datasets { get; } + /// Array of event statuses that describe the status of each event. + public IReadOnlyList Events { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.Serialization.cs new file mode 100644 index 000000000000..f166f84c1bd3 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryAssetStatusDataset : 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(DeviceRegistryAssetStatusDataset)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(MessageSchemaReference)) + { + writer.WritePropertyName("messageSchemaReference"u8); + writer.WriteObjectValue(MessageSchemaReference, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryAssetStatusDataset 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(DeviceRegistryAssetStatusDataset)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryAssetStatusDataset(document.RootElement, options); + } + + internal static DeviceRegistryAssetStatusDataset DeserializeDeviceRegistryAssetStatusDataset(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + MessageSchemaReference messageSchemaReference = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("messageSchemaReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + messageSchemaReference = MessageSchemaReference.DeserializeMessageSchemaReference(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryAssetStatusDataset(name, messageSchemaReference, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusDataset)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryAssetStatusDataset IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryAssetStatusDataset(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusDataset)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.cs new file mode 100644 index 000000000000..42bfbbab746a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusDataset.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the asset status dataset properties. + public partial class DeviceRegistryAssetStatusDataset + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. + internal DeviceRegistryAssetStatusDataset(string name) + { + Name = name; + } + + /// Initializes a new instance of . + /// The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. + /// The message schema reference object. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryAssetStatusDataset(string name, MessageSchemaReference messageSchemaReference, IDictionary serializedAdditionalRawData) + { + Name = name; + MessageSchemaReference = messageSchemaReference; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryAssetStatusDataset() + { + } + + /// The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. + public string Name { get; } + /// The message schema reference object. + public MessageSchemaReference MessageSchemaReference { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.Serialization.cs similarity index 52% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.Serialization.cs index e8623de9c6f2..e401b4462af6 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class UsernamePasswordCredentialsUpdate : IUtf8JsonSerializable, IJsonModel + public partial class DeviceRegistryAssetStatusError : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,21 +28,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UsernamePasswordCredentialsUpdate)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusError)} does not support writing '{format}' format."); } - if (Optional.IsDefined(UsernameReference)) + if (options.Format != "W" && Optional.IsDefined(Code)) { - writer.WritePropertyName("usernameReference"u8); - writer.WriteStringValue(UsernameReference); + writer.WritePropertyName("code"u8); + writer.WriteNumberValue(Code.Value); } - if (Optional.IsDefined(PasswordReference)) + if (options.Format != "W" && Optional.IsDefined(Message)) { - writer.WritePropertyName("passwordReference"u8); - writer.WriteStringValue(PasswordReference); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UsernamePasswordCredentialsUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeviceRegistryAssetStatusError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UsernamePasswordCredentialsUpdate)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusError)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUsernamePasswordCredentialsUpdate(document.RootElement, options); + return DeserializeDeviceRegistryAssetStatusError(document.RootElement, options); } - internal static UsernamePasswordCredentialsUpdate DeserializeUsernamePasswordCredentialsUpdate(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeviceRegistryAssetStatusError DeserializeDeviceRegistryAssetStatusError(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,20 +81,24 @@ internal static UsernamePasswordCredentialsUpdate DeserializeUsernamePasswordCre { return null; } - string usernameReference = default; - string passwordReference = default; + int? code = default; + string message = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("usernameReference"u8)) + if (property.NameEquals("code"u8)) { - usernameReference = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + code = property.Value.GetInt32(); continue; } - if (property.NameEquals("passwordReference"u8)) + if (property.NameEquals("message"u8)) { - passwordReference = property.Value.GetString(); + message = property.Value.GetString(); continue; } if (options.Format != "W") @@ -103,38 +107,38 @@ internal static UsernamePasswordCredentialsUpdate DeserializeUsernamePasswordCre } } serializedAdditionalRawData = rawDataDictionary; - return new UsernamePasswordCredentialsUpdate(usernameReference, passwordReference, serializedAdditionalRawData); + return new DeviceRegistryAssetStatusError(code, message, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(UsernamePasswordCredentialsUpdate)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusError)} does not support writing '{options.Format}' format."); } } - UsernamePasswordCredentialsUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeviceRegistryAssetStatusError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeUsernamePasswordCredentialsUpdate(document.RootElement, options); + return DeserializeDeviceRegistryAssetStatusError(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UsernamePasswordCredentialsUpdate)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusError)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.cs similarity index 84% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.cs index a48a66b15fd3..762686e57b9d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetStatusError.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusError.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// Defines the asset status error properties. - public partial class AssetStatusError + public partial class DeviceRegistryAssetStatusError { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class AssetStatusError /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AssetStatusError() + /// Initializes a new instance of . + internal DeviceRegistryAssetStatusError() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Error code for classification of errors (ex: 400, 404, 500, etc.). /// Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). /// Keeps track of any properties unknown to the library. - internal AssetStatusError(int? code, string message, IDictionary serializedAdditionalRawData) + internal DeviceRegistryAssetStatusError(int? code, string message, IDictionary serializedAdditionalRawData) { Code = code; Message = message; diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.Serialization.cs new file mode 100644 index 000000000000..24e34f7bac09 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryAssetStatusEvent : 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(DeviceRegistryAssetStatusEvent)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(MessageSchemaReference)) + { + writer.WritePropertyName("messageSchemaReference"u8); + writer.WriteObjectValue(MessageSchemaReference, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryAssetStatusEvent 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(DeviceRegistryAssetStatusEvent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryAssetStatusEvent(document.RootElement, options); + } + + internal static DeviceRegistryAssetStatusEvent DeserializeDeviceRegistryAssetStatusEvent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + MessageSchemaReference messageSchemaReference = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("messageSchemaReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + messageSchemaReference = MessageSchemaReference.DeserializeMessageSchemaReference(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryAssetStatusEvent(name, messageSchemaReference, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusEvent)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryAssetStatusEvent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryAssetStatusEvent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryAssetStatusEvent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.cs new file mode 100644 index 000000000000..d754e315ae13 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAssetStatusEvent.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the asset status event properties. + public partial class DeviceRegistryAssetStatusEvent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. + internal DeviceRegistryAssetStatusEvent(string name) + { + Name = name; + } + + /// Initializes a new instance of . + /// The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. + /// The message schema reference object. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryAssetStatusEvent(string name, MessageSchemaReference messageSchemaReference, IDictionary serializedAdditionalRawData) + { + Name = name; + MessageSchemaReference = messageSchemaReference; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryAssetStatusEvent() + { + } + + /// The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. + public string Name { get; } + /// The message schema reference object. + public MessageSchemaReference MessageSchemaReference { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.Serialization.cs similarity index 59% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.Serialization.cs index 59706b3bce9a..4e3ea3fb2f8b 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class UserAuthentication : IUtf8JsonSerializable, IJsonModel + public partial class DeviceRegistryAuthentication : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,14 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UserAuthentication)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAuthentication)} does not support writing '{format}' format."); } - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.ToString()); + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); if (Optional.IsDefined(UsernamePasswordCredentials)) { writer.WritePropertyName("usernamePasswordCredentials"u8); @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UserAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeviceRegistryAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UserAuthentication)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAuthentication)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUserAuthentication(document.RootElement, options); + return DeserializeDeviceRegistryAuthentication(document.RootElement, options); } - internal static UserAuthentication DeserializeUserAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeviceRegistryAuthentication DeserializeDeviceRegistryAuthentication(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,16 +83,16 @@ internal static UserAuthentication DeserializeUserAuthentication(JsonElement ele { return null; } - UserAuthenticationMode mode = default; - UsernamePasswordCredentials usernamePasswordCredentials = default; - X509Credentials x509Credentials = default; + AuthenticationMethod method = default; + DeviceRegistryUsernamePasswordCredentials usernamePasswordCredentials = default; + DeviceRegistryX509Credentials x509Credentials = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("mode"u8)) + if (property.NameEquals("method"u8)) { - mode = new UserAuthenticationMode(property.Value.GetString()); + method = new AuthenticationMethod(property.Value.GetString()); continue; } if (property.NameEquals("usernamePasswordCredentials"u8)) @@ -101,7 +101,7 @@ internal static UserAuthentication DeserializeUserAuthentication(JsonElement ele { continue; } - usernamePasswordCredentials = UsernamePasswordCredentials.DeserializeUsernamePasswordCredentials(property.Value, options); + usernamePasswordCredentials = DeviceRegistryUsernamePasswordCredentials.DeserializeDeviceRegistryUsernamePasswordCredentials(property.Value, options); continue; } if (property.NameEquals("x509Credentials"u8)) @@ -110,7 +110,7 @@ internal static UserAuthentication DeserializeUserAuthentication(JsonElement ele { continue; } - x509Credentials = X509Credentials.DeserializeX509Credentials(property.Value, options); + x509Credentials = DeviceRegistryX509Credentials.DeserializeDeviceRegistryX509Credentials(property.Value, options); continue; } if (options.Format != "W") @@ -119,38 +119,38 @@ internal static UserAuthentication DeserializeUserAuthentication(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new UserAuthentication(mode, usernamePasswordCredentials, x509Credentials, serializedAdditionalRawData); + return new DeviceRegistryAuthentication(method, usernamePasswordCredentials, x509Credentials, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(UserAuthentication)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAuthentication)} does not support writing '{options.Format}' format."); } } - UserAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeviceRegistryAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeUserAuthentication(document.RootElement, options); + return DeserializeDeviceRegistryAuthentication(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UserAuthentication)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryAuthentication)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.cs similarity index 61% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.cs index 9cbf420d03b1..6b25a5db924d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthentication.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryAuthentication.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// Definition of the client authentication mechanism to the server. - public partial class UserAuthentication + public partial class DeviceRegistryAuthentication { /// /// Keeps track of any properties unknown to the library. @@ -45,42 +45,42 @@ public partial class UserAuthentication /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Defines the mode to authenticate the user of the client at the server. - public UserAuthentication(UserAuthenticationMode mode) + /// Initializes a new instance of . + /// Defines the method to authenticate the user of the client at the server. + public DeviceRegistryAuthentication(AuthenticationMethod method) { - Mode = mode; + Method = method; } - /// Initializes a new instance of . - /// Defines the mode to authenticate the user of the client at the server. + /// Initializes a new instance of . + /// Defines the method to authenticate the user of the client at the server. /// Defines the username and password references when UsernamePassword user authentication mode is selected. /// Defines the certificate reference when Certificate user authentication mode is selected. /// Keeps track of any properties unknown to the library. - internal UserAuthentication(UserAuthenticationMode mode, UsernamePasswordCredentials usernamePasswordCredentials, X509Credentials x509Credentials, IDictionary serializedAdditionalRawData) + internal DeviceRegistryAuthentication(AuthenticationMethod method, DeviceRegistryUsernamePasswordCredentials usernamePasswordCredentials, DeviceRegistryX509Credentials x509Credentials, IDictionary serializedAdditionalRawData) { - Mode = mode; + Method = method; UsernamePasswordCredentials = usernamePasswordCredentials; X509Credentials = x509Credentials; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal UserAuthentication() + /// Initializes a new instance of for deserialization. + internal DeviceRegistryAuthentication() { } - /// Defines the mode to authenticate the user of the client at the server. - public UserAuthenticationMode Mode { get; set; } + /// Defines the method to authenticate the user of the client at the server. + public AuthenticationMethod Method { get; set; } /// Defines the username and password references when UsernamePassword user authentication mode is selected. - public UsernamePasswordCredentials UsernamePasswordCredentials { get; set; } + public DeviceRegistryUsernamePasswordCredentials UsernamePasswordCredentials { get; set; } /// Defines the certificate reference when Certificate user authentication mode is selected. - internal X509Credentials X509Credentials { get; set; } - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - public string X509CredentialsCertificateReference + internal DeviceRegistryX509Credentials X509Credentials { get; set; } + /// The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + public string X509CredentialsCertificateSecretName { - get => X509Credentials is null ? default : X509Credentials.CertificateReference; - set => X509Credentials = new X509Credentials(value); + get => X509Credentials is null ? default : X509Credentials.CertificateSecretName; + set => X509Credentials = new DeviceRegistryX509Credentials(value); } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.Serialization.cs new file mode 100644 index 000000000000..93050bc20c88 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistryDataPoint : 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(DeviceRegistryDataPoint)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ObservabilityMode)) + { + writer.WritePropertyName("observabilityMode"u8); + writer.WriteStringValue(ObservabilityMode.Value.ToString()); + } + } + + DeviceRegistryDataPoint 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(DeviceRegistryDataPoint)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDataPoint(document.RootElement, options); + } + + internal static DeviceRegistryDataPoint DeserializeDeviceRegistryDataPoint(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataPointObservabilityMode? observabilityMode = default; + string name = default; + string dataSource = default; + string dataPointConfiguration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("observabilityMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observabilityMode = new DataPointObservabilityMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSource"u8)) + { + dataSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataPointConfiguration"u8)) + { + dataPointConfiguration = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDataPoint(name, dataSource, dataPointConfiguration, serializedAdditionalRawData, observabilityMode); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDataPoint)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDataPoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDataPoint(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDataPoint)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.cs new file mode 100644 index 000000000000..c335db22bd36 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPoint.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the data point properties. + public partial class DeviceRegistryDataPoint : DeviceRegistryDataPointBase + { + /// Initializes a new instance of . + /// The name of the data point. + /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. + /// or is null. + public DeviceRegistryDataPoint(string name, string dataSource) : base(name, dataSource) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(dataSource, nameof(dataSource)); + } + + /// Initializes a new instance of . + /// The name of the data point. + /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. + /// Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Keeps track of any properties unknown to the library. + /// An indication of how the data point should be mapped to OpenTelemetry. + internal DeviceRegistryDataPoint(string name, string dataSource, string dataPointConfiguration, IDictionary serializedAdditionalRawData, DataPointObservabilityMode? observabilityMode) : base(name, dataSource, dataPointConfiguration, serializedAdditionalRawData) + { + ObservabilityMode = observabilityMode; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDataPoint() + { + } + + /// An indication of how the data point should be mapped to OpenTelemetry. + public DataPointObservabilityMode? ObservabilityMode { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.Serialization.cs similarity index 58% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.Serialization.cs index bdc7c7adca26..93e0fbc197d9 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class UsernamePasswordCredentials : IUtf8JsonSerializable, IJsonModel + public partial class DeviceRegistryDataPointBase : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UsernamePasswordCredentials)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryDataPointBase)} does not support writing '{format}' format."); } - writer.WritePropertyName("usernameReference"u8); - writer.WriteStringValue(UsernameReference); - writer.WritePropertyName("passwordReference"u8); - writer.WriteStringValue(PasswordReference); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource); + if (Optional.IsDefined(DataPointConfiguration)) + { + writer.WritePropertyName("dataPointConfiguration"u8); + writer.WriteStringValue(DataPointConfiguration); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +60,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UsernamePasswordCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeviceRegistryDataPointBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UsernamePasswordCredentials)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryDataPointBase)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUsernamePasswordCredentials(document.RootElement, options); + return DeserializeDeviceRegistryDataPointBase(document.RootElement, options); } - internal static UsernamePasswordCredentials DeserializeUsernamePasswordCredentials(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeviceRegistryDataPointBase DeserializeDeviceRegistryDataPointBase(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,20 +80,26 @@ internal static UsernamePasswordCredentials DeserializeUsernamePasswordCredentia { return null; } - string usernameReference = default; - string passwordReference = default; + string name = default; + string dataSource = default; + string dataPointConfiguration = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("usernameReference"u8)) + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSource"u8)) { - usernameReference = property.Value.GetString(); + dataSource = property.Value.GetString(); continue; } - if (property.NameEquals("passwordReference"u8)) + if (property.NameEquals("dataPointConfiguration"u8)) { - passwordReference = property.Value.GetString(); + dataPointConfiguration = property.Value.GetString(); continue; } if (options.Format != "W") @@ -97,38 +108,38 @@ internal static UsernamePasswordCredentials DeserializeUsernamePasswordCredentia } } serializedAdditionalRawData = rawDataDictionary; - return new UsernamePasswordCredentials(usernameReference, passwordReference, serializedAdditionalRawData); + return new DeviceRegistryDataPointBase(name, dataSource, dataPointConfiguration, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(UsernamePasswordCredentials)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryDataPointBase)} does not support writing '{options.Format}' format."); } } - UsernamePasswordCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeviceRegistryDataPointBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeUsernamePasswordCredentials(document.RootElement, options); + return DeserializeDeviceRegistryDataPointBase(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UsernamePasswordCredentials)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryDataPointBase)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.cs new file mode 100644 index 000000000000..dfe2d2c25a09 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataPointBase.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the data point properties. + public partial class DeviceRegistryDataPointBase + { + /// + /// 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 protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the data point. + /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. + /// or is null. + public DeviceRegistryDataPointBase(string name, string dataSource) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(dataSource, nameof(dataSource)); + + Name = name; + DataSource = dataSource; + } + + /// Initializes a new instance of . + /// The name of the data point. + /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. + /// Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDataPointBase(string name, string dataSource, string dataPointConfiguration, IDictionary serializedAdditionalRawData) + { + Name = name; + DataSource = dataSource; + DataPointConfiguration = dataPointConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDataPointBase() + { + } + + /// The name of the data point. + public string Name { get; set; } + /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. + public string DataSource { get; set; } + /// Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + public string DataPointConfiguration { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.Serialization.cs new file mode 100644 index 000000000000..2dcc2f66b07b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistryDataset : 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(DeviceRegistryDataset)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(DatasetConfiguration)) + { + writer.WritePropertyName("datasetConfiguration"u8); + writer.WriteStringValue(DatasetConfiguration); + } + if (Optional.IsDefined(Topic)) + { + writer.WritePropertyName("topic"u8); + writer.WriteObjectValue(Topic, options); + } + if (Optional.IsCollectionDefined(DataPoints)) + { + writer.WritePropertyName("dataPoints"u8); + writer.WriteStartArray(); + foreach (var item in DataPoints) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryDataset 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(DeviceRegistryDataset)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDataset(document.RootElement, options); + } + + internal static DeviceRegistryDataset DeserializeDeviceRegistryDataset(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string datasetConfiguration = default; + DeviceRegistryTopic topic = default; + IList dataPoints = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("datasetConfiguration"u8)) + { + datasetConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("topic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("dataPoints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryDataPoint.DeserializeDeviceRegistryDataPoint(item, options)); + } + dataPoints = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDataset(name, datasetConfiguration, topic, dataPoints ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDataset)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDataset IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDataset(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDataset)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.cs new file mode 100644 index 000000000000..ed281d44ee3b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDataset.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the dataset properties. + public partial class DeviceRegistryDataset + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the dataset. + /// is null. + public DeviceRegistryDataset(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + DataPoints = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of the dataset. + /// Stringified JSON that contains connector-specific JSON string that describes configuration for the specific dataset. + /// Object that describes the topic information for the specific dataset. + /// Array of data points that are part of the dataset. Each data point can have per-data point configuration. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDataset(string name, string datasetConfiguration, DeviceRegistryTopic topic, IList dataPoints, IDictionary serializedAdditionalRawData) + { + Name = name; + DatasetConfiguration = datasetConfiguration; + Topic = topic; + DataPoints = dataPoints; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDataset() + { + } + + /// Name of the dataset. + public string Name { get; set; } + /// Stringified JSON that contains connector-specific JSON string that describes configuration for the specific dataset. + public string DatasetConfiguration { get; set; } + /// Object that describes the topic information for the specific dataset. + public DeviceRegistryTopic Topic { get; set; } + /// Array of data points that are part of the dataset. Each data point can have per-data point configuration. + public IList DataPoints { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.Serialization.cs new file mode 100644 index 000000000000..c88f921b4fab --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryDiscoveredAssetEndpointProfilePatch : 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(DeviceRegistryDiscoveredAssetEndpointProfilePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryDiscoveredAssetEndpointProfilePatch 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(DeviceRegistryDiscoveredAssetEndpointProfilePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDiscoveredAssetEndpointProfilePatch(document.RootElement, options); + } + + internal static DeviceRegistryDiscoveredAssetEndpointProfilePatch DeserializeDeviceRegistryDiscoveredAssetEndpointProfilePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + DiscoveredAssetEndpointProfileUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DiscoveredAssetEndpointProfileUpdateProperties.DeserializeDiscoveredAssetEndpointProfileUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDiscoveredAssetEndpointProfilePatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetEndpointProfilePatch)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDiscoveredAssetEndpointProfilePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDiscoveredAssetEndpointProfilePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetEndpointProfilePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.cs similarity index 58% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.cs index b7e68aa108e3..453a08d4ba5d 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetEndpointProfilePatch.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - /// Definition of the authentication mechanism for the southbound connector. - internal partial class TransportAuthenticationUpdate + /// The type used for update operations of the DiscoveredAssetEndpointProfile. + public partial class DeviceRegistryDiscoveredAssetEndpointProfilePatch { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,26 @@ internal partial class TransportAuthenticationUpdate /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public TransportAuthenticationUpdate() + /// Initializes a new instance of . + public DeviceRegistryDiscoveredAssetEndpointProfilePatch() { - OwnCertificates = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal TransportAuthenticationUpdate(IList ownCertificates, IDictionary serializedAdditionalRawData) + internal DeviceRegistryDiscoveredAssetEndpointProfilePatch(IDictionary tags, DiscoveredAssetEndpointProfileUpdateProperties properties, IDictionary serializedAdditionalRawData) { - OwnCertificates = ownCertificates; + Tags = tags; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - public IList OwnCertificates { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public DiscoveredAssetEndpointProfileUpdateProperties Properties { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.Serialization.cs new file mode 100644 index 000000000000..a1dd38d62e10 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryDiscoveredAssetPatch : 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(DeviceRegistryDiscoveredAssetPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryDiscoveredAssetPatch 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(DeviceRegistryDiscoveredAssetPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDiscoveredAssetPatch(document.RootElement, options); + } + + internal static DeviceRegistryDiscoveredAssetPatch DeserializeDeviceRegistryDiscoveredAssetPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + DiscoveredAssetUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DiscoveredAssetUpdateProperties.DeserializeDiscoveredAssetUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDiscoveredAssetPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetPatch)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDiscoveredAssetPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDiscoveredAssetPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.cs new file mode 100644 index 000000000000..08c89ec146f6 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The type used for update operations of the DiscoveredAsset. + public partial class DeviceRegistryDiscoveredAssetPatch + { + /// + /// 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 DeviceRegistryDiscoveredAssetPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDiscoveredAssetPatch(IDictionary tags, DiscoveredAssetUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public DiscoveredAssetUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.Serialization.cs new file mode 100644 index 000000000000..d2fdb98730af --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.Serialization.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryDiscoveredAssetProperties : 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(DeviceRegistryDiscoveredAssetProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("assetEndpointProfileRef"u8); + writer.WriteStringValue(AssetEndpointProfileRef); + writer.WritePropertyName("discoveryId"u8); + writer.WriteStringValue(DiscoveryId); + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version); + if (Optional.IsDefined(Manufacturer)) + { + writer.WritePropertyName("manufacturer"u8); + writer.WriteStringValue(Manufacturer); + } + if (Optional.IsDefined(ManufacturerUri)) + { + writer.WritePropertyName("manufacturerUri"u8); + writer.WriteStringValue(ManufacturerUri.AbsoluteUri); + } + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + } + if (Optional.IsDefined(ProductCode)) + { + writer.WritePropertyName("productCode"u8); + writer.WriteStringValue(ProductCode); + } + if (Optional.IsDefined(HardwareRevision)) + { + writer.WritePropertyName("hardwareRevision"u8); + writer.WriteStringValue(HardwareRevision); + } + if (Optional.IsDefined(SoftwareRevision)) + { + writer.WritePropertyName("softwareRevision"u8); + writer.WriteStringValue(SoftwareRevision); + } + if (Optional.IsDefined(DocumentationUri)) + { + writer.WritePropertyName("documentationUri"u8); + writer.WriteStringValue(DocumentationUri.AbsoluteUri); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsDefined(DefaultDatasetsConfiguration)) + { + writer.WritePropertyName("defaultDatasetsConfiguration"u8); + writer.WriteStringValue(DefaultDatasetsConfiguration); + } + if (Optional.IsDefined(DefaultEventsConfiguration)) + { + writer.WritePropertyName("defaultEventsConfiguration"u8); + writer.WriteStringValue(DefaultEventsConfiguration); + } + if (Optional.IsDefined(DefaultTopic)) + { + writer.WritePropertyName("defaultTopic"u8); + writer.WriteObjectValue(DefaultTopic, options); + } + if (Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (var item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryDiscoveredAssetProperties 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(DeviceRegistryDiscoveredAssetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryDiscoveredAssetProperties(document.RootElement, options); + } + + internal static DeviceRegistryDiscoveredAssetProperties DeserializeDeviceRegistryDiscoveredAssetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string assetEndpointProfileRef = default; + string discoveryId = default; + long version = default; + string manufacturer = default; + Uri manufacturerUri = default; + string model = default; + string productCode = default; + string hardwareRevision = default; + string softwareRevision = default; + Uri documentationUri = default; + string serialNumber = default; + string defaultDatasetsConfiguration = default; + string defaultEventsConfiguration = default; + DeviceRegistryTopic defaultTopic = default; + IList datasets = default; + IList events = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assetEndpointProfileRef"u8)) + { + assetEndpointProfileRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("discoveryId"u8)) + { + discoveryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("manufacturer"u8)) + { + manufacturer = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturerUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + manufacturerUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("productCode"u8)) + { + productCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("hardwareRevision"u8)) + { + hardwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("softwareRevision"u8)) + { + softwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("documentationUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultDatasetsConfiguration"u8)) + { + defaultDatasetsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultEventsConfiguration"u8)) + { + defaultEventsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTopic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultTopic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoveredDataset.DeserializeDiscoveredDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoveredEvent.DeserializeDiscoveredEvent(item, options)); + } + events = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryDiscoveredAssetProperties( + assetEndpointProfileRef, + discoveryId, + version, + manufacturer, + manufacturerUri, + model, + productCode, + hardwareRevision, + softwareRevision, + documentationUri, + serialNumber, + defaultDatasetsConfiguration, + defaultEventsConfiguration, + defaultTopic, + datasets ?? new ChangeTrackingList(), + events ?? new ChangeTrackingList(), + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetProperties)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryDiscoveredAssetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryDiscoveredAssetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryDiscoveredAssetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.cs new file mode 100644 index 000000000000..d09dc205a5b7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryDiscoveredAssetProperties.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the discovered asset properties. + public partial class DeviceRegistryDiscoveredAssetProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + /// Identifier used to detect changes in the asset. + /// An integer that is incremented each time the resource is modified. + /// or is null. + public DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef, string discoveryId, long version) + { + Argument.AssertNotNull(assetEndpointProfileRef, nameof(assetEndpointProfileRef)); + Argument.AssertNotNull(discoveryId, nameof(discoveryId)); + + AssetEndpointProfileRef = assetEndpointProfileRef; + DiscoveryId = discoveryId; + Version = version; + Datasets = new ChangeTrackingList(); + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + /// Identifier used to detect changes in the asset. + /// An integer that is incremented each time the resource is modified. + /// Asset manufacturer name. + /// Asset manufacturer URI. + /// Asset model name. + /// Asset product code. + /// Revision number of the hardware. + /// Revision number of the software. + /// Reference to the documentation. + /// Asset serial number. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryDiscoveredAssetProperties(string assetEndpointProfileRef, string discoveryId, long version, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, string defaultDatasetsConfiguration, string defaultEventsConfiguration, DeviceRegistryTopic defaultTopic, IList datasets, IList events, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + AssetEndpointProfileRef = assetEndpointProfileRef; + DiscoveryId = discoveryId; + Version = version; + Manufacturer = manufacturer; + ManufacturerUri = manufacturerUri; + Model = model; + ProductCode = productCode; + HardwareRevision = hardwareRevision; + SoftwareRevision = softwareRevision; + DocumentationUri = documentationUri; + SerialNumber = serialNumber; + DefaultDatasetsConfiguration = defaultDatasetsConfiguration; + DefaultEventsConfiguration = defaultEventsConfiguration; + DefaultTopic = defaultTopic; + Datasets = datasets; + Events = events; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryDiscoveredAssetProperties() + { + } + + /// A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. + public string AssetEndpointProfileRef { get; set; } + /// Identifier used to detect changes in the asset. + public string DiscoveryId { get; set; } + /// An integer that is incremented each time the resource is modified. + public long Version { get; set; } + /// Asset manufacturer name. + public string Manufacturer { get; set; } + /// Asset manufacturer URI. + public Uri ManufacturerUri { get; set; } + /// Asset model name. + public string Model { get; set; } + /// Asset product code. + public string ProductCode { get; set; } + /// Revision number of the hardware. + public string HardwareRevision { get; set; } + /// Revision number of the software. + public string SoftwareRevision { get; set; } + /// Reference to the documentation. + public Uri DocumentationUri { get; set; } + /// Asset serial number. + public string SerialNumber { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + public string DefaultDatasetsConfiguration { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + public string DefaultEventsConfiguration { get; set; } + /// Object that describes the default topic information for the asset. + public DeviceRegistryTopic DefaultTopic { get; set; } + /// Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + public IList Datasets { get; } + /// Array of events that are part of the asset. Each event can have per-event configuration. + public IList Events { get; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.Serialization.cs new file mode 100644 index 000000000000..ebf1f775073c --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistryEvent : 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(DeviceRegistryEvent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ObservabilityMode)) + { + writer.WritePropertyName("observabilityMode"u8); + writer.WriteStringValue(ObservabilityMode.Value.ToString()); + } + } + + DeviceRegistryEvent 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(DeviceRegistryEvent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryEvent(document.RootElement, options); + } + + internal static DeviceRegistryEvent DeserializeDeviceRegistryEvent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EventObservabilityMode? observabilityMode = default; + string name = default; + string eventNotifier = default; + string eventConfiguration = default; + DeviceRegistryTopic topic = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("observabilityMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observabilityMode = new EventObservabilityMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventNotifier"u8)) + { + eventNotifier = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventConfiguration"u8)) + { + eventConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("topic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryEvent( + name, + eventNotifier, + eventConfiguration, + topic, + serializedAdditionalRawData, + observabilityMode); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryEvent)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryEvent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryEvent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryEvent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.cs new file mode 100644 index 000000000000..8d37a46d5413 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEvent.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the event properties. + public partial class DeviceRegistryEvent : DeviceRegistryEventBase + { + /// Initializes a new instance of . + /// The name of the event. + /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. + /// or is null. + public DeviceRegistryEvent(string name, string eventNotifier) : base(name, eventNotifier) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(eventNotifier, nameof(eventNotifier)); + } + + /// Initializes a new instance of . + /// The name of the event. + /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. + /// Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Object that describes the topic information for the specific event. + /// Keeps track of any properties unknown to the library. + /// An indication of how the event should be mapped to OpenTelemetry. + internal DeviceRegistryEvent(string name, string eventNotifier, string eventConfiguration, DeviceRegistryTopic topic, IDictionary serializedAdditionalRawData, EventObservabilityMode? observabilityMode) : base(name, eventNotifier, eventConfiguration, topic, serializedAdditionalRawData) + { + ObservabilityMode = observabilityMode; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryEvent() + { + } + + /// An indication of how the event should be mapped to OpenTelemetry. + public EventObservabilityMode? ObservabilityMode { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.Serialization.cs new file mode 100644 index 000000000000..3867c4b89033 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistryEventBase : 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(DeviceRegistryEventBase)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("eventNotifier"u8); + writer.WriteStringValue(EventNotifier); + if (Optional.IsDefined(EventConfiguration)) + { + writer.WritePropertyName("eventConfiguration"u8); + writer.WriteStringValue(EventConfiguration); + } + if (Optional.IsDefined(Topic)) + { + writer.WritePropertyName("topic"u8); + writer.WriteObjectValue(Topic, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryEventBase 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(DeviceRegistryEventBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryEventBase(document.RootElement, options); + } + + internal static DeviceRegistryEventBase DeserializeDeviceRegistryEventBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string eventNotifier = default; + string eventConfiguration = default; + DeviceRegistryTopic topic = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventNotifier"u8)) + { + eventNotifier = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventConfiguration"u8)) + { + eventConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("topic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryEventBase(name, eventNotifier, eventConfiguration, topic, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryEventBase)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryEventBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryEventBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryEventBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.cs new file mode 100644 index 000000000000..18ba8138b91e --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryEventBase.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the event properties. + public partial class DeviceRegistryEventBase + { + /// + /// 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 protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the event. + /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. + /// or is null. + public DeviceRegistryEventBase(string name, string eventNotifier) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(eventNotifier, nameof(eventNotifier)); + + Name = name; + EventNotifier = eventNotifier; + } + + /// Initializes a new instance of . + /// The name of the event. + /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. + /// Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Object that describes the topic information for the specific event. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryEventBase(string name, string eventNotifier, string eventConfiguration, DeviceRegistryTopic topic, IDictionary serializedAdditionalRawData) + { + Name = name; + EventNotifier = eventNotifier; + EventConfiguration = eventConfiguration; + Topic = topic; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryEventBase() + { + } + + /// The name of the event. + public string Name { get; set; } + /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. + public string EventNotifier { get; set; } + /// Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + public string EventConfiguration { get; set; } + /// Object that describes the topic information for the specific event. + public DeviceRegistryTopic Topic { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryProvisioningState.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryProvisioningState.cs index 9dff56b64acb..1c253031dde6 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryProvisioningState.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryProvisioningState.cs @@ -26,6 +26,7 @@ public DeviceRegistryProvisioningState(string value) private const string FailedValue = "Failed"; private const string CanceledValue = "Canceled"; private const string AcceptedValue = "Accepted"; + private const string DeletingValue = "Deleting"; /// Resource has been created. public static DeviceRegistryProvisioningState Succeeded { get; } = new DeviceRegistryProvisioningState(SucceededValue); @@ -35,6 +36,8 @@ public DeviceRegistryProvisioningState(string value) public static DeviceRegistryProvisioningState Canceled { get; } = new DeviceRegistryProvisioningState(CanceledValue); /// Resource has been accepted by the server. public static DeviceRegistryProvisioningState Accepted { get; } = new DeviceRegistryProvisioningState(AcceptedValue); + /// Resource is deleting. + public static DeviceRegistryProvisioningState Deleting { get; } = new DeviceRegistryProvisioningState(DeletingValue); /// Determines if two values are the same. public static bool operator ==(DeviceRegistryProvisioningState left, DeviceRegistryProvisioningState right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaFormat.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaFormat.cs new file mode 100644 index 000000000000..6a0aac44a946 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the schema format. + public readonly partial struct DeviceRegistrySchemaFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeviceRegistrySchemaFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string JsonSchemaDraft7Value = "JsonSchema/draft-07"; + private const string Delta10Value = "Delta/1.0"; + + /// JSON Schema version draft 7 format. + public static DeviceRegistrySchemaFormat JsonSchemaDraft7 { get; } = new DeviceRegistrySchemaFormat(JsonSchemaDraft7Value); + /// Delta format. + public static DeviceRegistrySchemaFormat Delta10 { get; } = new DeviceRegistrySchemaFormat(Delta10Value); + /// Determines if two values are the same. + public static bool operator ==(DeviceRegistrySchemaFormat left, DeviceRegistrySchemaFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeviceRegistrySchemaFormat left, DeviceRegistrySchemaFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeviceRegistrySchemaFormat(string value) => new DeviceRegistrySchemaFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeviceRegistrySchemaFormat other && Equals(other); + /// + public bool Equals(DeviceRegistrySchemaFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.Serialization.cs new file mode 100644 index 000000000000..8fbb6df82eb8 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DeviceRegistrySchemaProperties : 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(DeviceRegistrySchemaProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("format"u8); + writer.WriteStringValue(Format.ToString()); + writer.WritePropertyName("schemaType"u8); + writer.WriteStringValue(SchemaType.ToString()); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistrySchemaProperties 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(DeviceRegistrySchemaProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaProperties(document.RootElement, options); + } + + internal static DeviceRegistrySchemaProperties DeserializeDeviceRegistrySchemaProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uuid = default; + string displayName = default; + string description = default; + DeviceRegistrySchemaFormat format = default; + DeviceRegistrySchemaType schemaType = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("format"u8)) + { + format = new DeviceRegistrySchemaFormat(property.Value.GetString()); + continue; + } + if (property.NameEquals("schemaType"u8)) + { + schemaType = new DeviceRegistrySchemaType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistrySchemaProperties( + uuid, + displayName, + description, + format, + schemaType, + provisioningState, + tags ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaProperties)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.cs new file mode 100644 index 000000000000..7863d8ea1f2b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaProperties.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the schema properties. + public partial class DeviceRegistrySchemaProperties + { + /// + /// 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 . + /// Format of the schema. + /// Type of the schema. + public DeviceRegistrySchemaProperties(DeviceRegistrySchemaFormat format, DeviceRegistrySchemaType schemaType) + { + Format = format; + SchemaType = schemaType; + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Human-readable display name. + /// Human-readable description of the schema. + /// Format of the schema. + /// Type of the schema. + /// Provisioning state of the resource. + /// Schema tags. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaProperties(string uuid, string displayName, string description, DeviceRegistrySchemaFormat format, DeviceRegistrySchemaType schemaType, DeviceRegistryProvisioningState? provisioningState, IDictionary tags, IDictionary serializedAdditionalRawData) + { + Uuid = uuid; + DisplayName = displayName; + Description = description; + Format = format; + SchemaType = schemaType; + ProvisioningState = provisioningState; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistrySchemaProperties() + { + } + + /// Globally unique, immutable, non-reusable id. + public string Uuid { get; } + /// Human-readable display name. + public string DisplayName { get; set; } + /// Human-readable description of the schema. + public string Description { get; set; } + /// Format of the schema. + public DeviceRegistrySchemaFormat Format { get; set; } + /// Type of the schema. + public DeviceRegistrySchemaType SchemaType { get; set; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + /// Schema tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.Serialization.cs new file mode 100644 index 000000000000..0ed57195ecb4 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistrySchemaRegistryPatch : 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(DeviceRegistrySchemaRegistryPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistrySchemaRegistryPatch 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(DeviceRegistrySchemaRegistryPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaRegistryPatch(document.RootElement, options); + } + + internal static DeviceRegistrySchemaRegistryPatch DeserializeDeviceRegistrySchemaRegistryPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + IDictionary tags = default; + SchemaRegistryUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SchemaRegistryUpdateProperties.DeserializeSchemaRegistryUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistrySchemaRegistryPatch(identity, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryPatch)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaRegistryPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaRegistryPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.cs new file mode 100644 index 000000000000..39dfa47de47f --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryPatch.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The type used for update operations of the SchemaRegistry. + public partial class DeviceRegistrySchemaRegistryPatch + { + /// + /// 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 DeviceRegistrySchemaRegistryPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaRegistryPatch(ManagedServiceIdentity identity, IDictionary tags, SchemaRegistryUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + public ManagedServiceIdentity Identity { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public SchemaRegistryUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.Serialization.cs new file mode 100644 index 000000000000..cf5bd474a3e4 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistrySchemaRegistryProperties : 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(DeviceRegistrySchemaRegistryProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("storageAccountContainerUrl"u8); + writer.WriteStringValue(StorageAccountContainerUri.AbsoluteUri); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistrySchemaRegistryProperties 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(DeviceRegistrySchemaRegistryProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaRegistryProperties(document.RootElement, options); + } + + internal static DeviceRegistrySchemaRegistryProperties DeserializeDeviceRegistrySchemaRegistryProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uuid = default; + string @namespace = default; + string displayName = default; + string description = default; + Uri storageAccountContainerUrl = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountContainerUrl"u8)) + { + storageAccountContainerUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistrySchemaRegistryProperties( + uuid, + @namespace, + displayName, + description, + storageAccountContainerUrl, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryProperties)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaRegistryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaRegistryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaRegistryProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.cs new file mode 100644 index 000000000000..402afa0db927 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaRegistryProperties.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the schema registry properties. + public partial class DeviceRegistrySchemaRegistryProperties + { + /// + /// 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 . + /// Schema registry namespace. Uniquely identifies a schema registry within a tenant. + /// The Storage Account's Container URL where schemas will be stored. + /// or is null. + public DeviceRegistrySchemaRegistryProperties(string @namespace, Uri storageAccountContainerUri) + { + Argument.AssertNotNull(@namespace, nameof(@namespace)); + Argument.AssertNotNull(storageAccountContainerUri, nameof(storageAccountContainerUri)); + + Namespace = @namespace; + StorageAccountContainerUri = storageAccountContainerUri; + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Schema registry namespace. Uniquely identifies a schema registry within a tenant. + /// Human-readable display name. + /// Human-readable description of the schema registry. + /// The Storage Account's Container URL where schemas will be stored. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaRegistryProperties(string uuid, string @namespace, string displayName, string description, Uri storageAccountContainerUri, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Uuid = uuid; + Namespace = @namespace; + DisplayName = displayName; + Description = description; + StorageAccountContainerUri = storageAccountContainerUri; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistrySchemaRegistryProperties() + { + } + + /// Globally unique, immutable, non-reusable id. + public string Uuid { get; } + /// Schema registry namespace. Uniquely identifies a schema registry within a tenant. + public string Namespace { get; set; } + /// Human-readable display name. + public string DisplayName { get; set; } + /// Human-readable description of the schema registry. + public string Description { get; set; } + /// The Storage Account's Container URL where schemas will be stored. + public Uri StorageAccountContainerUri { get; set; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaType.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaType.cs new file mode 100644 index 000000000000..a5a143bcbd26 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the schema type. + public readonly partial struct DeviceRegistrySchemaType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeviceRegistrySchemaType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MessageSchemaValue = "MessageSchema"; + + /// Message Schema schema type. + public static DeviceRegistrySchemaType MessageSchema { get; } = new DeviceRegistrySchemaType(MessageSchemaValue); + /// Determines if two values are the same. + public static bool operator ==(DeviceRegistrySchemaType left, DeviceRegistrySchemaType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeviceRegistrySchemaType left, DeviceRegistrySchemaType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeviceRegistrySchemaType(string value) => new DeviceRegistrySchemaType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeviceRegistrySchemaType other && Equals(other); + /// + public bool Equals(DeviceRegistrySchemaType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.Serialization.cs new file mode 100644 index 000000000000..a4468d02ca4d --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistrySchemaVersionProperties : 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(DeviceRegistrySchemaVersionProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("schemaContent"u8); + writer.WriteStringValue(SchemaContent); + if (options.Format != "W" && Optional.IsDefined(Hash)) + { + writer.WritePropertyName("hash"u8); + writer.WriteStringValue(Hash); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistrySchemaVersionProperties 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(DeviceRegistrySchemaVersionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistrySchemaVersionProperties(document.RootElement, options); + } + + internal static DeviceRegistrySchemaVersionProperties DeserializeDeviceRegistrySchemaVersionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uuid = default; + string description = default; + string schemaContent = default; + string hash = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("schemaContent"u8)) + { + schemaContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("hash"u8)) + { + hash = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistrySchemaVersionProperties( + uuid, + description, + schemaContent, + hash, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaVersionProperties)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistrySchemaVersionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistrySchemaVersionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistrySchemaVersionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.cs new file mode 100644 index 000000000000..12ec0a826707 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistrySchemaVersionProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the schema version properties. + public partial class DeviceRegistrySchemaVersionProperties + { + /// + /// 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 . + /// Schema content. + /// is null. + public DeviceRegistrySchemaVersionProperties(string schemaContent) + { + Argument.AssertNotNull(schemaContent, nameof(schemaContent)); + + SchemaContent = schemaContent; + } + + /// Initializes a new instance of . + /// Globally unique, immutable, non-reusable id. + /// Human-readable description of the schema. + /// Schema content. + /// Hash of the schema content. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistrySchemaVersionProperties(string uuid, string description, string schemaContent, string hash, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Uuid = uuid; + Description = description; + SchemaContent = schemaContent; + Hash = hash; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistrySchemaVersionProperties() + { + } + + /// Globally unique, immutable, non-reusable id. + public string Uuid { get; } + /// Human-readable description of the schema. + public string Description { get; set; } + /// Schema content. + public string SchemaContent { get; set; } + /// Hash of the schema content. + public string Hash { get; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.Serialization.cs new file mode 100644 index 000000000000..70ae1baf2f43 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistryTopic : 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(DeviceRegistryTopic)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + if (Optional.IsDefined(Retain)) + { + writer.WritePropertyName("retain"u8); + writer.WriteStringValue(Retain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryTopic 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(DeviceRegistryTopic)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryTopic(document.RootElement, options); + } + + internal static DeviceRegistryTopic DeserializeDeviceRegistryTopic(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + DeviceRegistryTopicRetainType? retain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("retain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + retain = new DeviceRegistryTopicRetainType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryTopic(path, retain, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryTopic)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryTopic IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryTopic(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryTopic)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.cs new file mode 100644 index 000000000000..90ac20b1eb3a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopic.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.DeviceRegistry.Models +{ + /// Object that describes the topic information. + public partial class DeviceRegistryTopic + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The topic path for messages published to an MQTT broker. + /// is null. + public DeviceRegistryTopic(string path) + { + Argument.AssertNotNull(path, nameof(path)); + + Path = path; + } + + /// Initializes a new instance of . + /// The topic path for messages published to an MQTT broker. + /// When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. + /// Keeps track of any properties unknown to the library. + internal DeviceRegistryTopic(string path, DeviceRegistryTopicRetainType? retain, IDictionary serializedAdditionalRawData) + { + Path = path; + Retain = retain; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceRegistryTopic() + { + } + + /// The topic path for messages published to an MQTT broker. + public string Path { get; set; } + /// When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. + public DeviceRegistryTopicRetainType? Retain { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopicRetainType.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopicRetainType.cs new file mode 100644 index 000000000000..ef1ce7618e50 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryTopicRetainType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Topic retain types. + public readonly partial struct DeviceRegistryTopicRetainType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeviceRegistryTopicRetainType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeepValue = "Keep"; + private const string NeverValue = "Never"; + + /// Retain the messages. + public static DeviceRegistryTopicRetainType Keep { get; } = new DeviceRegistryTopicRetainType(KeepValue); + /// Never retain messages. + public static DeviceRegistryTopicRetainType Never { get; } = new DeviceRegistryTopicRetainType(NeverValue); + /// Determines if two values are the same. + public static bool operator ==(DeviceRegistryTopicRetainType left, DeviceRegistryTopicRetainType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeviceRegistryTopicRetainType left, DeviceRegistryTopicRetainType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeviceRegistryTopicRetainType(string value) => new DeviceRegistryTopicRetainType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeviceRegistryTopicRetainType other && Equals(other); + /// + public bool Equals(DeviceRegistryTopicRetainType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.Serialization.cs new file mode 100644 index 000000000000..86a65c6598f2 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DeviceRegistryUsernamePasswordCredentials : 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(DeviceRegistryUsernamePasswordCredentials)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("usernameSecretName"u8); + writer.WriteStringValue(UsernameSecretName); + writer.WritePropertyName("passwordSecretName"u8); + writer.WriteStringValue(PasswordSecretName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeviceRegistryUsernamePasswordCredentials 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(DeviceRegistryUsernamePasswordCredentials)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceRegistryUsernamePasswordCredentials(document.RootElement, options); + } + + internal static DeviceRegistryUsernamePasswordCredentials DeserializeDeviceRegistryUsernamePasswordCredentials(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string usernameSecretName = default; + string passwordSecretName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usernameSecretName"u8)) + { + usernameSecretName = property.Value.GetString(); + continue; + } + if (property.NameEquals("passwordSecretName"u8)) + { + passwordSecretName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeviceRegistryUsernamePasswordCredentials(usernameSecretName, passwordSecretName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeviceRegistryUsernamePasswordCredentials)} does not support writing '{options.Format}' format."); + } + } + + DeviceRegistryUsernamePasswordCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeviceRegistryUsernamePasswordCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeviceRegistryUsernamePasswordCredentials)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.cs similarity index 51% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.cs index 48c765c69436..5a91f99bda7c 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentials.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryUsernamePasswordCredentials.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// The credentials for authentication mode UsernamePassword. - public partial class UsernamePasswordCredentials + public partial class DeviceRegistryUsernamePasswordCredentials { /// /// Keeps track of any properties unknown to the library. @@ -45,38 +45,38 @@ public partial class UsernamePasswordCredentials /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// A reference to secret containing the username. - /// A reference to secret containing the password. - /// or is null. - public UsernamePasswordCredentials(string usernameReference, string passwordReference) + /// Initializes a new instance of . + /// The name of the secret containing the username. + /// The name of the secret containing the password. + /// or is null. + public DeviceRegistryUsernamePasswordCredentials(string usernameSecretName, string passwordSecretName) { - Argument.AssertNotNull(usernameReference, nameof(usernameReference)); - Argument.AssertNotNull(passwordReference, nameof(passwordReference)); + Argument.AssertNotNull(usernameSecretName, nameof(usernameSecretName)); + Argument.AssertNotNull(passwordSecretName, nameof(passwordSecretName)); - UsernameReference = usernameReference; - PasswordReference = passwordReference; + UsernameSecretName = usernameSecretName; + PasswordSecretName = passwordSecretName; } - /// Initializes a new instance of . - /// A reference to secret containing the username. - /// A reference to secret containing the password. + /// Initializes a new instance of . + /// The name of the secret containing the username. + /// The name of the secret containing the password. /// Keeps track of any properties unknown to the library. - internal UsernamePasswordCredentials(string usernameReference, string passwordReference, IDictionary serializedAdditionalRawData) + internal DeviceRegistryUsernamePasswordCredentials(string usernameSecretName, string passwordSecretName, IDictionary serializedAdditionalRawData) { - UsernameReference = usernameReference; - PasswordReference = passwordReference; + UsernameSecretName = usernameSecretName; + PasswordSecretName = passwordSecretName; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal UsernamePasswordCredentials() + /// Initializes a new instance of for deserialization. + internal DeviceRegistryUsernamePasswordCredentials() { } - /// A reference to secret containing the username. - public string UsernameReference { get; set; } - /// A reference to secret containing the password. - public string PasswordReference { get; set; } + /// The name of the secret containing the username. + public string UsernameSecretName { get; set; } + /// The name of the secret containing the password. + public string PasswordSecretName { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.Serialization.cs similarity index 57% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.Serialization.cs index ffc3e9bad440..09c497543738 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthenticationUpdate.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - internal partial class TransportAuthenticationUpdate : IUtf8JsonSerializable, IJsonModel + internal partial class DeviceRegistryX509Credentials : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,22 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(TransportAuthenticationUpdate)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryX509Credentials)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(OwnCertificates)) - { - writer.WritePropertyName("ownCertificates"u8); - writer.WriteStartArray(); - foreach (var item in OwnCertificates) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } + writer.WritePropertyName("certificateSecretName"u8); + writer.WriteStringValue(CertificateSecretName); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -61,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - TransportAuthenticationUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeviceRegistryX509Credentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(TransportAuthenticationUpdate)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryX509Credentials)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTransportAuthenticationUpdate(document.RootElement, options); + return DeserializeDeviceRegistryX509Credentials(document.RootElement, options); } - internal static TransportAuthenticationUpdate DeserializeTransportAuthenticationUpdate(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeviceRegistryX509Credentials DeserializeDeviceRegistryX509Credentials(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,23 +73,14 @@ internal static TransportAuthenticationUpdate DeserializeTransportAuthentication { return null; } - IList ownCertificates = default; + string certificateSecretName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("ownCertificates"u8)) + if (property.NameEquals("certificateSecretName"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(OwnCertificate.DeserializeOwnCertificate(item, options)); - } - ownCertificates = array; + certificateSecretName = property.Value.GetString(); continue; } if (options.Format != "W") @@ -106,38 +89,38 @@ internal static TransportAuthenticationUpdate DeserializeTransportAuthentication } } serializedAdditionalRawData = rawDataDictionary; - return new TransportAuthenticationUpdate(ownCertificates ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DeviceRegistryX509Credentials(certificateSecretName, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(TransportAuthenticationUpdate)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryX509Credentials)} does not support writing '{options.Format}' format."); } } - TransportAuthenticationUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeviceRegistryX509Credentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeTransportAuthenticationUpdate(document.RootElement, options); + return DeserializeDeviceRegistryX509Credentials(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(TransportAuthenticationUpdate)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceRegistryX509Credentials)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.cs similarity index 58% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.cs index a638fce6428e..9c9adc1cb2e9 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DeviceRegistryX509Credentials.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// The x509 certificate for authentication mode Certificate. - internal partial class X509Credentials + internal partial class DeviceRegistryX509Credentials { /// /// Keeps track of any properties unknown to the library. @@ -45,31 +45,31 @@ internal partial class X509Credentials /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - /// is null. - public X509Credentials(string certificateReference) + /// Initializes a new instance of . + /// The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + /// is null. + public DeviceRegistryX509Credentials(string certificateSecretName) { - Argument.AssertNotNull(certificateReference, nameof(certificateReference)); + Argument.AssertNotNull(certificateSecretName, nameof(certificateSecretName)); - CertificateReference = certificateReference; + CertificateSecretName = certificateSecretName; } - /// Initializes a new instance of . - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + /// Initializes a new instance of . + /// The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). /// Keeps track of any properties unknown to the library. - internal X509Credentials(string certificateReference, IDictionary serializedAdditionalRawData) + internal DeviceRegistryX509Credentials(string certificateSecretName, IDictionary serializedAdditionalRawData) { - CertificateReference = certificateReference; + CertificateSecretName = certificateSecretName; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal X509Credentials() + /// Initializes a new instance of for deserialization. + internal DeviceRegistryX509Credentials() { } - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - public string CertificateReference { get; set; } + /// The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + public string CertificateSecretName { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.Serialization.cs new file mode 100644 index 000000000000..0e4d21adf0c7 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + internal partial class DiscoveredAssetEndpointProfileListResult : 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(DiscoveredAssetEndpointProfileListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredAssetEndpointProfileListResult 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(DiscoveredAssetEndpointProfileListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement, options); + } + + internal static DiscoveredAssetEndpointProfileListResult DeserializeDiscoveredAssetEndpointProfileListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredAssetEndpointProfileListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileListResult)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredAssetEndpointProfileListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.cs new file mode 100644 index 000000000000..e842dc9788bd --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The response of a DiscoveredAssetEndpointProfile list operation. + internal partial class DiscoveredAssetEndpointProfileListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The DiscoveredAssetEndpointProfile items on this page. + /// is null. + internal DiscoveredAssetEndpointProfileListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The DiscoveredAssetEndpointProfile items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DiscoveredAssetEndpointProfileListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoveredAssetEndpointProfileListResult() + { + } + + /// The DiscoveredAssetEndpointProfile items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.Serialization.cs new file mode 100644 index 000000000000..fe43ac62e719 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.Serialization.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DiscoveredAssetEndpointProfileProperties : 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(DiscoveredAssetEndpointProfileProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("targetAddress"u8); + writer.WriteStringValue(TargetAddress.AbsoluteUri); + if (Optional.IsDefined(AdditionalConfiguration)) + { + writer.WritePropertyName("additionalConfiguration"u8); + writer.WriteStringValue(AdditionalConfiguration); + } + if (Optional.IsCollectionDefined(SupportedAuthenticationMethods)) + { + writer.WritePropertyName("supportedAuthenticationMethods"u8); + writer.WriteStartArray(); + foreach (var item in SupportedAuthenticationMethods) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("endpointProfileType"u8); + writer.WriteStringValue(EndpointProfileType); + writer.WritePropertyName("discoveryId"u8); + writer.WriteStringValue(DiscoveryId); + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredAssetEndpointProfileProperties 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(DiscoveredAssetEndpointProfileProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredAssetEndpointProfileProperties(document.RootElement, options); + } + + internal static DiscoveredAssetEndpointProfileProperties DeserializeDiscoveredAssetEndpointProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri targetAddress = default; + string additionalConfiguration = default; + IList supportedAuthenticationMethods = default; + string endpointProfileType = default; + string discoveryId = default; + long version = default; + DeviceRegistryProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetAddress"u8)) + { + targetAddress = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("additionalConfiguration"u8)) + { + additionalConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportedAuthenticationMethods"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AuthenticationMethod(item.GetString())); + } + supportedAuthenticationMethods = array; + continue; + } + if (property.NameEquals("endpointProfileType"u8)) + { + endpointProfileType = property.Value.GetString(); + continue; + } + if (property.NameEquals("discoveryId"u8)) + { + discoveryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DeviceRegistryProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredAssetEndpointProfileProperties( + targetAddress, + additionalConfiguration, + supportedAuthenticationMethods ?? new ChangeTrackingList(), + endpointProfileType, + discoveryId, + version, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileProperties)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredAssetEndpointProfileProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredAssetEndpointProfileProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.cs new file mode 100644 index 000000000000..44f41ea969ce --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileProperties.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the Discovered Asset Endpoint Profile properties. + public partial class DiscoveredAssetEndpointProfileProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Identifier used to detect changes in the asset endpoint profile. + /// An integer that is incremented each time the resource is modified. + /// , or is null. + public DiscoveredAssetEndpointProfileProperties(Uri targetAddress, string endpointProfileType, string discoveryId, long version) + { + Argument.AssertNotNull(targetAddress, nameof(targetAddress)); + Argument.AssertNotNull(endpointProfileType, nameof(endpointProfileType)); + Argument.AssertNotNull(discoveryId, nameof(discoveryId)); + + TargetAddress = targetAddress; + SupportedAuthenticationMethods = new ChangeTrackingList(); + EndpointProfileType = endpointProfileType; + DiscoveryId = discoveryId; + Version = version; + } + + /// Initializes a new instance of . + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// List of supported authentication methods supported by the target server. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Identifier used to detect changes in the asset endpoint profile. + /// An integer that is incremented each time the resource is modified. + /// Provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DiscoveredAssetEndpointProfileProperties(Uri targetAddress, string additionalConfiguration, IList supportedAuthenticationMethods, string endpointProfileType, string discoveryId, long version, DeviceRegistryProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + TargetAddress = targetAddress; + AdditionalConfiguration = additionalConfiguration; + SupportedAuthenticationMethods = supportedAuthenticationMethods; + EndpointProfileType = endpointProfileType; + DiscoveryId = discoveryId; + Version = version; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoveredAssetEndpointProfileProperties() + { + } + + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + public Uri TargetAddress { get; set; } + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + public string AdditionalConfiguration { get; set; } + /// List of supported authentication methods supported by the target server. + public IList SupportedAuthenticationMethods { get; } + /// Defines the configuration for the connector type that is being used with the endpoint profile. + public string EndpointProfileType { get; set; } + /// Identifier used to detect changes in the asset endpoint profile. + public string DiscoveryId { get; set; } + /// An integer that is incremented each time the resource is modified. + public long Version { get; set; } + /// Provisioning state of the resource. + public DeviceRegistryProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..73bdab54ce8d --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DiscoveredAssetEndpointProfileUpdateProperties : 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(DiscoveredAssetEndpointProfileUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(TargetAddress)) + { + writer.WritePropertyName("targetAddress"u8); + writer.WriteStringValue(TargetAddress.AbsoluteUri); + } + if (Optional.IsDefined(AdditionalConfiguration)) + { + writer.WritePropertyName("additionalConfiguration"u8); + writer.WriteStringValue(AdditionalConfiguration); + } + if (Optional.IsCollectionDefined(SupportedAuthenticationMethods)) + { + writer.WritePropertyName("supportedAuthenticationMethods"u8); + writer.WriteStartArray(); + foreach (var item in SupportedAuthenticationMethods) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EndpointProfileType)) + { + writer.WritePropertyName("endpointProfileType"u8); + writer.WriteStringValue(EndpointProfileType); + } + if (Optional.IsDefined(DiscoveryId)) + { + writer.WritePropertyName("discoveryId"u8); + writer.WriteStringValue(DiscoveryId); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredAssetEndpointProfileUpdateProperties 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(DiscoveredAssetEndpointProfileUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredAssetEndpointProfileUpdateProperties(document.RootElement, options); + } + + internal static DiscoveredAssetEndpointProfileUpdateProperties DeserializeDiscoveredAssetEndpointProfileUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri targetAddress = default; + string additionalConfiguration = default; + IList supportedAuthenticationMethods = default; + string endpointProfileType = default; + string discoveryId = default; + long? version = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetAddress = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("additionalConfiguration"u8)) + { + additionalConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportedAuthenticationMethods"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AuthenticationMethod(item.GetString())); + } + supportedAuthenticationMethods = array; + continue; + } + if (property.NameEquals("endpointProfileType"u8)) + { + endpointProfileType = property.Value.GetString(); + continue; + } + if (property.NameEquals("discoveryId"u8)) + { + discoveryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredAssetEndpointProfileUpdateProperties( + targetAddress, + additionalConfiguration, + supportedAuthenticationMethods ?? new ChangeTrackingList(), + endpointProfileType, + discoveryId, + version, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredAssetEndpointProfileUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredAssetEndpointProfileUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredAssetEndpointProfileUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.cs new file mode 100644 index 000000000000..13d6727b30ab --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetEndpointProfileUpdateProperties.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The updatable properties of the DiscoveredAssetEndpointProfile. + public partial class DiscoveredAssetEndpointProfileUpdateProperties + { + /// + /// 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 DiscoveredAssetEndpointProfileUpdateProperties() + { + SupportedAuthenticationMethods = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + /// List of supported authentication methods supported by the target server. + /// Defines the configuration for the connector type that is being used with the endpoint profile. + /// Identifier used to detect changes in the asset endpoint profile. + /// An integer that is incremented each time the resource is modified. + /// Keeps track of any properties unknown to the library. + internal DiscoveredAssetEndpointProfileUpdateProperties(Uri targetAddress, string additionalConfiguration, IList supportedAuthenticationMethods, string endpointProfileType, string discoveryId, long? version, IDictionary serializedAdditionalRawData) + { + TargetAddress = targetAddress; + AdditionalConfiguration = additionalConfiguration; + SupportedAuthenticationMethods = supportedAuthenticationMethods; + EndpointProfileType = endpointProfileType; + DiscoveryId = discoveryId; + Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + public Uri TargetAddress { get; set; } + /// Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + public string AdditionalConfiguration { get; set; } + /// List of supported authentication methods supported by the target server. + public IList SupportedAuthenticationMethods { get; } + /// Defines the configuration for the connector type that is being used with the endpoint profile. + public string EndpointProfileType { get; set; } + /// Identifier used to detect changes in the asset endpoint profile. + public string DiscoveryId { get; set; } + /// An integer that is incremented each time the resource is modified. + public long? Version { get; set; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.Serialization.cs new file mode 100644 index 000000000000..1f09da57e4ec --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + internal partial class DiscoveredAssetListResult : 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(DiscoveredAssetListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredAssetListResult 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(DiscoveredAssetListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredAssetListResult(document.RootElement, options); + } + + internal static DiscoveredAssetListResult DeserializeDiscoveredAssetListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredAssetListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredAssetListResult)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredAssetListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredAssetListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredAssetListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.cs similarity index 55% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.cs index 55285384275b..1182e1bde8a7 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetListResult.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DeviceRegistry.Models { - /// Certificate or private key that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - public partial class OwnCertificate + /// The response of a DiscoveredAsset list operation. + internal partial class DiscoveredAssetListResult { /// /// Keeps track of any properties unknown to the library. @@ -45,29 +46,35 @@ public partial class OwnCertificate /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public OwnCertificate() + /// Initializes a new instance of . + /// The DiscoveredAsset items on this page. + /// is null. + internal DiscoveredAssetListResult(IEnumerable value) { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// Certificate thumbprint. - /// Secret Reference name (cert and private key). - /// Secret Reference Name (Pfx or Pem password). + /// Initializes a new instance of . + /// The DiscoveredAsset items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal OwnCertificate(string certThumbprint, string certSecretReference, string certPasswordReference, IDictionary serializedAdditionalRawData) + internal DiscoveredAssetListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { - CertThumbprint = certThumbprint; - CertSecretReference = certSecretReference; - CertPasswordReference = certPasswordReference; + Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Certificate thumbprint. - public string CertThumbprint { get; set; } - /// Secret Reference name (cert and private key). - public string CertSecretReference { get; set; } - /// Secret Reference Name (Pfx or Pem password). - public string CertPasswordReference { get; set; } + /// Initializes a new instance of for deserialization. + internal DiscoveredAssetListResult() + { + } + + /// The DiscoveredAsset items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..555ed3a9fc16 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.Serialization.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class DiscoveredAssetUpdateProperties : 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(DiscoveredAssetUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DiscoveryId)) + { + writer.WritePropertyName("discoveryId"u8); + writer.WriteStringValue(DiscoveryId); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (Optional.IsDefined(Manufacturer)) + { + writer.WritePropertyName("manufacturer"u8); + writer.WriteStringValue(Manufacturer); + } + if (Optional.IsDefined(ManufacturerUri)) + { + writer.WritePropertyName("manufacturerUri"u8); + writer.WriteStringValue(ManufacturerUri.AbsoluteUri); + } + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(Model); + } + if (Optional.IsDefined(ProductCode)) + { + writer.WritePropertyName("productCode"u8); + writer.WriteStringValue(ProductCode); + } + if (Optional.IsDefined(HardwareRevision)) + { + writer.WritePropertyName("hardwareRevision"u8); + writer.WriteStringValue(HardwareRevision); + } + if (Optional.IsDefined(SoftwareRevision)) + { + writer.WritePropertyName("softwareRevision"u8); + writer.WriteStringValue(SoftwareRevision); + } + if (Optional.IsDefined(DocumentationUri)) + { + writer.WritePropertyName("documentationUri"u8); + writer.WriteStringValue(DocumentationUri.AbsoluteUri); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsDefined(DefaultDatasetsConfiguration)) + { + writer.WritePropertyName("defaultDatasetsConfiguration"u8); + writer.WriteStringValue(DefaultDatasetsConfiguration); + } + if (Optional.IsDefined(DefaultEventsConfiguration)) + { + writer.WritePropertyName("defaultEventsConfiguration"u8); + writer.WriteStringValue(DefaultEventsConfiguration); + } + if (Optional.IsDefined(DefaultTopic)) + { + writer.WritePropertyName("defaultTopic"u8); + writer.WriteObjectValue(DefaultTopic, options); + } + if (Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (var item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredAssetUpdateProperties 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(DiscoveredAssetUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredAssetUpdateProperties(document.RootElement, options); + } + + internal static DiscoveredAssetUpdateProperties DeserializeDiscoveredAssetUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string discoveryId = default; + long? version = default; + string manufacturer = default; + Uri manufacturerUri = default; + string model = default; + string productCode = default; + string hardwareRevision = default; + string softwareRevision = default; + Uri documentationUri = default; + string serialNumber = default; + string defaultDatasetsConfiguration = default; + string defaultEventsConfiguration = default; + DeviceRegistryTopic defaultTopic = default; + IList datasets = default; + IList events = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("discoveryId"u8)) + { + discoveryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("manufacturer"u8)) + { + manufacturer = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturerUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + manufacturerUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("model"u8)) + { + model = property.Value.GetString(); + continue; + } + if (property.NameEquals("productCode"u8)) + { + productCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("hardwareRevision"u8)) + { + hardwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("softwareRevision"u8)) + { + softwareRevision = property.Value.GetString(); + continue; + } + if (property.NameEquals("documentationUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultDatasetsConfiguration"u8)) + { + defaultDatasetsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultEventsConfiguration"u8)) + { + defaultEventsConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultTopic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultTopic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoveredDataset.DeserializeDiscoveredDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoveredEvent.DeserializeDiscoveredEvent(item, options)); + } + events = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredAssetUpdateProperties( + discoveryId, + version, + manufacturer, + manufacturerUri, + model, + productCode, + hardwareRevision, + softwareRevision, + documentationUri, + serialNumber, + defaultDatasetsConfiguration, + defaultEventsConfiguration, + defaultTopic, + datasets ?? new ChangeTrackingList(), + events ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredAssetUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredAssetUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredAssetUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredAssetUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.cs new file mode 100644 index 000000000000..a296876891ef --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredAssetUpdateProperties.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The updatable properties of the DiscoveredAsset. + public partial class DiscoveredAssetUpdateProperties + { + /// + /// 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 DiscoveredAssetUpdateProperties() + { + Datasets = new ChangeTrackingList(); + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Identifier used to detect changes in the asset. + /// An integer that is incremented each time the resource is modified. + /// Asset manufacturer name. + /// Asset manufacturer URI. + /// Asset model name. + /// Asset product code. + /// Revision number of the hardware. + /// Revision number of the software. + /// Reference to the documentation. + /// Asset serial number. + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + /// Object that describes the default topic information for the asset. + /// Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + /// Array of events that are part of the asset. Each event can have per-event configuration. + /// Keeps track of any properties unknown to the library. + internal DiscoveredAssetUpdateProperties(string discoveryId, long? version, string manufacturer, Uri manufacturerUri, string model, string productCode, string hardwareRevision, string softwareRevision, Uri documentationUri, string serialNumber, string defaultDatasetsConfiguration, string defaultEventsConfiguration, DeviceRegistryTopic defaultTopic, IList datasets, IList events, IDictionary serializedAdditionalRawData) + { + DiscoveryId = discoveryId; + Version = version; + Manufacturer = manufacturer; + ManufacturerUri = manufacturerUri; + Model = model; + ProductCode = productCode; + HardwareRevision = hardwareRevision; + SoftwareRevision = softwareRevision; + DocumentationUri = documentationUri; + SerialNumber = serialNumber; + DefaultDatasetsConfiguration = defaultDatasetsConfiguration; + DefaultEventsConfiguration = defaultEventsConfiguration; + DefaultTopic = defaultTopic; + Datasets = datasets; + Events = events; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Identifier used to detect changes in the asset. + public string DiscoveryId { get; set; } + /// An integer that is incremented each time the resource is modified. + public long? Version { get; set; } + /// Asset manufacturer name. + public string Manufacturer { get; set; } + /// Asset manufacturer URI. + public Uri ManufacturerUri { get; set; } + /// Asset model name. + public string Model { get; set; } + /// Asset product code. + public string ProductCode { get; set; } + /// Revision number of the hardware. + public string HardwareRevision { get; set; } + /// Revision number of the software. + public string SoftwareRevision { get; set; } + /// Reference to the documentation. + public Uri DocumentationUri { get; set; } + /// Asset serial number. + public string SerialNumber { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. + public string DefaultDatasetsConfiguration { get; set; } + /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. + public string DefaultEventsConfiguration { get; set; } + /// Object that describes the default topic information for the asset. + public DeviceRegistryTopic DefaultTopic { get; set; } + /// Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + public IList Datasets { get; } + /// Array of events that are part of the asset. Each event can have per-event configuration. + public IList Events { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.Serialization.cs similarity index 61% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.Serialization.cs index d8f8b0864535..5249c8529804 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class DataPoint : IUtf8JsonSerializable, IJsonModel + public partial class DiscoveredDataPoint : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,34 +28,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(DataPoint)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DiscoveredDataPoint)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); writer.WritePropertyName("dataSource"u8); writer.WriteStringValue(DataSource); - if (Optional.IsDefined(CapabilityId)) - { - writer.WritePropertyName("capabilityId"u8); - writer.WriteStringValue(CapabilityId); - } - if (Optional.IsDefined(ObservabilityMode)) - { - writer.WritePropertyName("observabilityMode"u8); - writer.WriteStringValue(ObservabilityMode.Value.ToString()); - } if (Optional.IsDefined(DataPointConfiguration)) { writer.WritePropertyName("dataPointConfiguration"u8); writer.WriteStringValue(DataPointConfiguration); } + if (Optional.IsDefined(LastUpdatedOn)) + { + writer.WritePropertyName("lastUpdatedOn"u8); + writer.WriteStringValue(LastUpdatedOn.Value, "O"); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -73,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DataPoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DiscoveredDataPoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(DataPoint)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DiscoveredDataPoint)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDataPoint(document.RootElement, options); + return DeserializeDiscoveredDataPoint(document.RootElement, options); } - internal static DataPoint DeserializeDataPoint(JsonElement element, ModelReaderWriterOptions options = null) + internal static DiscoveredDataPoint DeserializeDiscoveredDataPoint(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -95,9 +87,8 @@ internal static DataPoint DeserializeDataPoint(JsonElement element, ModelReaderW } string name = default; string dataSource = default; - string capabilityId = default; - DataPointsObservabilityMode? observabilityMode = default; string dataPointConfiguration = default; + DateTimeOffset? lastUpdatedOn = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -112,23 +103,18 @@ internal static DataPoint DeserializeDataPoint(JsonElement element, ModelReaderW dataSource = property.Value.GetString(); continue; } - if (property.NameEquals("capabilityId"u8)) + if (property.NameEquals("dataPointConfiguration"u8)) { - capabilityId = property.Value.GetString(); + dataPointConfiguration = property.Value.GetString(); continue; } - if (property.NameEquals("observabilityMode"u8)) + if (property.NameEquals("lastUpdatedOn"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - observabilityMode = new DataPointsObservabilityMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("dataPointConfiguration"u8)) - { - dataPointConfiguration = property.Value.GetString(); + lastUpdatedOn = property.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") @@ -137,44 +123,38 @@ internal static DataPoint DeserializeDataPoint(JsonElement element, ModelReaderW } } serializedAdditionalRawData = rawDataDictionary; - return new DataPoint( - name, - dataSource, - capabilityId, - observabilityMode, - dataPointConfiguration, - serializedAdditionalRawData); + return new DiscoveredDataPoint(name, dataSource, dataPointConfiguration, lastUpdatedOn, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(DataPoint)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiscoveredDataPoint)} does not support writing '{options.Format}' format."); } } - DataPoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DiscoveredDataPoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDataPoint(document.RootElement, options); + return DeserializeDiscoveredDataPoint(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(DataPoint)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiscoveredDataPoint)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.cs similarity index 65% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.cs index f870594aed49..14ff31fca939 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DataPoint.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataPoint.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// Defines the data point properties. - public partial class DataPoint + public partial class DiscoveredDataPoint { /// /// Keeps track of any properties unknown to the library. @@ -45,35 +45,36 @@ public partial class DataPoint /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The name of the data point. /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. - /// is null. - public DataPoint(string dataSource) + /// or is null. + public DiscoveredDataPoint(string name, string dataSource) { + Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(dataSource, nameof(dataSource)); + Name = name; DataSource = dataSource; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the data point. /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. - /// The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - /// An indication of how the data point should be mapped to OpenTelemetry. - /// Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// UTC timestamp indicating when the data point was added or modified. /// Keeps track of any properties unknown to the library. - internal DataPoint(string name, string dataSource, string capabilityId, DataPointsObservabilityMode? observabilityMode, string dataPointConfiguration, IDictionary serializedAdditionalRawData) + internal DiscoveredDataPoint(string name, string dataSource, string dataPointConfiguration, DateTimeOffset? lastUpdatedOn, IDictionary serializedAdditionalRawData) { Name = name; DataSource = dataSource; - CapabilityId = capabilityId; - ObservabilityMode = observabilityMode; DataPointConfiguration = dataPointConfiguration; + LastUpdatedOn = lastUpdatedOn; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal DataPoint() + /// Initializes a new instance of for deserialization. + internal DiscoveredDataPoint() { } @@ -81,11 +82,9 @@ internal DataPoint() public string Name { get; set; } /// The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. public string DataSource { get; set; } - /// The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - public string CapabilityId { get; set; } - /// An indication of how the data point should be mapped to OpenTelemetry. - public DataPointsObservabilityMode? ObservabilityMode { get; set; } - /// Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. public string DataPointConfiguration { get; set; } + /// UTC timestamp indicating when the data point was added or modified. + public DateTimeOffset? LastUpdatedOn { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.Serialization.cs new file mode 100644 index 000000000000..aa0436223f2a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + public partial class DiscoveredDataset : 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(DiscoveredDataset)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(DatasetConfiguration)) + { + writer.WritePropertyName("datasetConfiguration"u8); + writer.WriteStringValue(DatasetConfiguration); + } + if (Optional.IsDefined(Topic)) + { + writer.WritePropertyName("topic"u8); + writer.WriteObjectValue(Topic, options); + } + if (Optional.IsCollectionDefined(DataPoints)) + { + writer.WritePropertyName("dataPoints"u8); + writer.WriteStartArray(); + foreach (var item in DataPoints) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiscoveredDataset 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(DiscoveredDataset)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoveredDataset(document.RootElement, options); + } + + internal static DiscoveredDataset DeserializeDiscoveredDataset(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string datasetConfiguration = default; + DeviceRegistryTopic topic = default; + IList dataPoints = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("datasetConfiguration"u8)) + { + datasetConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("topic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); + continue; + } + if (property.NameEquals("dataPoints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoveredDataPoint.DeserializeDiscoveredDataPoint(item, options)); + } + dataPoints = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoveredDataset(name, datasetConfiguration, topic, dataPoints ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoveredDataset)} does not support writing '{options.Format}' format."); + } + } + + DiscoveredDataset IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoveredDataset(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoveredDataset)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.cs new file mode 100644 index 000000000000..048e9382f363 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredDataset.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the dataset properties. + public partial class DiscoveredDataset + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the dataset. + /// is null. + public DiscoveredDataset(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + DataPoints = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of the dataset. + /// Stringified JSON that contains connector-specific properties that describes configuration for the specific dataset. + /// Object that describes the topic information for the specific dataset. + /// Array of data points that are part of the dataset. Each data point can have per-data point configuration. + /// Keeps track of any properties unknown to the library. + internal DiscoveredDataset(string name, string datasetConfiguration, DeviceRegistryTopic topic, IList dataPoints, IDictionary serializedAdditionalRawData) + { + Name = name; + DatasetConfiguration = datasetConfiguration; + Topic = topic; + DataPoints = dataPoints; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoveredDataset() + { + } + + /// Name of the dataset. + public string Name { get; set; } + /// Stringified JSON that contains connector-specific properties that describes configuration for the specific dataset. + public string DatasetConfiguration { get; set; } + /// Object that describes the topic information for the specific dataset. + public DeviceRegistryTopic Topic { get; set; } + /// Array of data points that are part of the dataset. Each data point can have per-data point configuration. + public IList DataPoints { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.Serialization.cs similarity index 62% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.Serialization.cs index 4bacbd195dd6..bfdaf1d4d06a 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class AssetEvent : IUtf8JsonSerializable, IJsonModel + public partial class DiscoveredEvent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,33 +28,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetEvent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DiscoveredEvent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); writer.WritePropertyName("eventNotifier"u8); writer.WriteStringValue(EventNotifier); - if (Optional.IsDefined(CapabilityId)) + if (Optional.IsDefined(EventConfiguration)) { - writer.WritePropertyName("capabilityId"u8); - writer.WriteStringValue(CapabilityId); + writer.WritePropertyName("eventConfiguration"u8); + writer.WriteStringValue(EventConfiguration); } - if (Optional.IsDefined(ObservabilityMode)) + if (Optional.IsDefined(Topic)) { - writer.WritePropertyName("observabilityMode"u8); - writer.WriteStringValue(ObservabilityMode.Value.ToString()); + writer.WritePropertyName("topic"u8); + writer.WriteObjectValue(Topic, options); } - if (Optional.IsDefined(EventConfiguration)) + if (Optional.IsDefined(LastUpdatedOn)) { - writer.WritePropertyName("eventConfiguration"u8); - writer.WriteStringValue(EventConfiguration); + writer.WritePropertyName("lastUpdatedOn"u8); + writer.WriteStringValue(LastUpdatedOn.Value, "O"); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -73,19 +70,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AssetEvent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DiscoveredEvent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AssetEvent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DiscoveredEvent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAssetEvent(document.RootElement, options); + return DeserializeDiscoveredEvent(document.RootElement, options); } - internal static AssetEvent DeserializeAssetEvent(JsonElement element, ModelReaderWriterOptions options = null) + internal static DiscoveredEvent DeserializeDiscoveredEvent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -95,9 +92,9 @@ internal static AssetEvent DeserializeAssetEvent(JsonElement element, ModelReade } string name = default; string eventNotifier = default; - string capabilityId = default; - EventsObservabilityMode? observabilityMode = default; string eventConfiguration = default; + DeviceRegistryTopic topic = default; + DateTimeOffset? lastUpdatedOn = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -112,23 +109,27 @@ internal static AssetEvent DeserializeAssetEvent(JsonElement element, ModelReade eventNotifier = property.Value.GetString(); continue; } - if (property.NameEquals("capabilityId"u8)) + if (property.NameEquals("eventConfiguration"u8)) { - capabilityId = property.Value.GetString(); + eventConfiguration = property.Value.GetString(); continue; } - if (property.NameEquals("observabilityMode"u8)) + if (property.NameEquals("topic"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - observabilityMode = new EventsObservabilityMode(property.Value.GetString()); + topic = DeviceRegistryTopic.DeserializeDeviceRegistryTopic(property.Value, options); continue; } - if (property.NameEquals("eventConfiguration"u8)) + if (property.NameEquals("lastUpdatedOn"u8)) { - eventConfiguration = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastUpdatedOn = property.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") @@ -137,44 +138,44 @@ internal static AssetEvent DeserializeAssetEvent(JsonElement element, ModelReade } } serializedAdditionalRawData = rawDataDictionary; - return new AssetEvent( + return new DiscoveredEvent( name, eventNotifier, - capabilityId, - observabilityMode, eventConfiguration, + topic, + lastUpdatedOn, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AssetEvent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiscoveredEvent)} does not support writing '{options.Format}' format."); } } - AssetEvent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DiscoveredEvent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeAssetEvent(document.RootElement, options); + return DeserializeDiscoveredEvent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AssetEvent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiscoveredEvent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.cs similarity index 60% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.cs index c1fbd0abf33e..9fe81c213d45 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/AssetEvent.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/DiscoveredEvent.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { /// Defines the event properties. - public partial class AssetEvent + public partial class DiscoveredEvent { /// /// Keeps track of any properties unknown to the library. @@ -45,35 +45,38 @@ public partial class AssetEvent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The name of the event. /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. - /// is null. - public AssetEvent(string eventNotifier) + /// or is null. + public DiscoveredEvent(string name, string eventNotifier) { + Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(eventNotifier, nameof(eventNotifier)); + Name = name; EventNotifier = eventNotifier; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the event. /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. - /// The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - /// An indication of how the event should be mapped to OpenTelemetry. - /// Protocol-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Object that describes the topic information for the specific event. + /// UTC timestamp indicating when the event was added or modified. /// Keeps track of any properties unknown to the library. - internal AssetEvent(string name, string eventNotifier, string capabilityId, EventsObservabilityMode? observabilityMode, string eventConfiguration, IDictionary serializedAdditionalRawData) + internal DiscoveredEvent(string name, string eventNotifier, string eventConfiguration, DeviceRegistryTopic topic, DateTimeOffset? lastUpdatedOn, IDictionary serializedAdditionalRawData) { Name = name; EventNotifier = eventNotifier; - CapabilityId = capabilityId; - ObservabilityMode = observabilityMode; EventConfiguration = eventConfiguration; + Topic = topic; + LastUpdatedOn = lastUpdatedOn; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal AssetEvent() + /// Initializes a new instance of for deserialization. + internal DiscoveredEvent() { } @@ -81,11 +84,11 @@ internal AssetEvent() public string Name { get; set; } /// The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. public string EventNotifier { get; set; } - /// The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - public string CapabilityId { get; set; } - /// An indication of how the event should be mapped to OpenTelemetry. - public EventsObservabilityMode? ObservabilityMode { get; set; } - /// Protocol-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + /// Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. public string EventConfiguration { get; set; } + /// Object that describes the topic information for the specific event. + public DeviceRegistryTopic Topic { get; set; } + /// UTC timestamp indicating when the event was added or modified. + public DateTimeOffset? LastUpdatedOn { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventObservabilityMode.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventObservabilityMode.cs new file mode 100644 index 000000000000..64392c15f8c1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventObservabilityMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// Defines the event observability mode. + public readonly partial struct EventObservabilityMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventObservabilityMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string LogValue = "Log"; + + /// No mapping to OpenTelemetry. + public static EventObservabilityMode None { get; } = new EventObservabilityMode(NoneValue); + /// Map as log to OpenTelemetry. + public static EventObservabilityMode Log { get; } = new EventObservabilityMode(LogValue); + /// Determines if two values are the same. + public static bool operator ==(EventObservabilityMode left, EventObservabilityMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventObservabilityMode left, EventObservabilityMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EventObservabilityMode(string value) => new EventObservabilityMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventObservabilityMode other && Equals(other); + /// + public bool Equals(EventObservabilityMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventsObservabilityMode.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventsObservabilityMode.cs deleted file mode 100644 index 4073e2f7d2db..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/EventsObservabilityMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - /// An indication of how the event should be mapped to OpenTelemetry. - public readonly partial struct EventsObservabilityMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EventsObservabilityMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "none"; - private const string LogValue = "log"; - - /// No mapping to OpenTelemetry. - public static EventsObservabilityMode None { get; } = new EventsObservabilityMode(NoneValue); - /// Map as log to OpenTelemetry. - public static EventsObservabilityMode Log { get; } = new EventsObservabilityMode(LogValue); - /// Determines if two values are the same. - public static bool operator ==(EventsObservabilityMode left, EventsObservabilityMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EventsObservabilityMode left, EventsObservabilityMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EventsObservabilityMode(string value) => new EventsObservabilityMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EventsObservabilityMode other && Equals(other); - /// - public bool Equals(EventsObservabilityMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.Serialization.cs similarity index 53% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.Serialization.cs index 351e3dc20a15..db3846882e88 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/OwnCertificate.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class OwnCertificate : IUtf8JsonSerializable, IJsonModel + public partial class MessageSchemaReference : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,26 +28,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OwnCertificate)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MessageSchemaReference)} does not support writing '{format}' format."); } - if (Optional.IsDefined(CertThumbprint)) + if (options.Format != "W") { - writer.WritePropertyName("certThumbprint"u8); - writer.WriteStringValue(CertThumbprint); + writer.WritePropertyName("schemaRegistryNamespace"u8); + writer.WriteStringValue(SchemaRegistryNamespace); } - if (Optional.IsDefined(CertSecretReference)) + if (options.Format != "W") { - writer.WritePropertyName("certSecretReference"u8); - writer.WriteStringValue(CertSecretReference); + writer.WritePropertyName("schemaName"u8); + writer.WriteStringValue(SchemaName); } - if (Optional.IsDefined(CertPasswordReference)) + if (options.Format != "W") { - writer.WritePropertyName("certPasswordReference"u8); - writer.WriteStringValue(CertPasswordReference); + writer.WritePropertyName("schemaVersion"u8); + writer.WriteStringValue(SchemaVersion); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - OwnCertificate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MessageSchemaReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OwnCertificate)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MessageSchemaReference)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOwnCertificate(document.RootElement, options); + return DeserializeMessageSchemaReference(document.RootElement, options); } - internal static OwnCertificate DeserializeOwnCertificate(JsonElement element, ModelReaderWriterOptions options = null) + internal static MessageSchemaReference DeserializeMessageSchemaReference(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,26 +86,26 @@ internal static OwnCertificate DeserializeOwnCertificate(JsonElement element, Mo { return null; } - string certThumbprint = default; - string certSecretReference = default; - string certPasswordReference = default; + string schemaRegistryNamespace = default; + string schemaName = default; + string schemaVersion = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("certThumbprint"u8)) + if (property.NameEquals("schemaRegistryNamespace"u8)) { - certThumbprint = property.Value.GetString(); + schemaRegistryNamespace = property.Value.GetString(); continue; } - if (property.NameEquals("certSecretReference"u8)) + if (property.NameEquals("schemaName"u8)) { - certSecretReference = property.Value.GetString(); + schemaName = property.Value.GetString(); continue; } - if (property.NameEquals("certPasswordReference"u8)) + if (property.NameEquals("schemaVersion"u8)) { - certPasswordReference = property.Value.GetString(); + schemaVersion = property.Value.GetString(); continue; } if (options.Format != "W") @@ -114,38 +114,38 @@ internal static OwnCertificate DeserializeOwnCertificate(JsonElement element, Mo } } serializedAdditionalRawData = rawDataDictionary; - return new OwnCertificate(certThumbprint, certSecretReference, certPasswordReference, serializedAdditionalRawData); + return new MessageSchemaReference(schemaRegistryNamespace, schemaName, schemaVersion, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(OwnCertificate)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MessageSchemaReference)} does not support writing '{options.Format}' format."); } } - OwnCertificate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MessageSchemaReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeOwnCertificate(document.RootElement, options); + return DeserializeMessageSchemaReference(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OwnCertificate)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MessageSchemaReference)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.cs new file mode 100644 index 000000000000..f23f6513828c --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/MessageSchemaReference.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.DeviceRegistry.Models +{ + /// Defines the message schema reference properties. + public partial class MessageSchemaReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The message schema registry namespace. + /// The message schema name. + /// The message schema version. + internal MessageSchemaReference(string schemaRegistryNamespace, string schemaName, string schemaVersion) + { + SchemaRegistryNamespace = schemaRegistryNamespace; + SchemaName = schemaName; + SchemaVersion = schemaVersion; + } + + /// Initializes a new instance of . + /// The message schema registry namespace. + /// The message schema name. + /// The message schema version. + /// Keeps track of any properties unknown to the library. + internal MessageSchemaReference(string schemaRegistryNamespace, string schemaName, string schemaVersion, IDictionary serializedAdditionalRawData) + { + SchemaRegistryNamespace = schemaRegistryNamespace; + SchemaName = schemaName; + SchemaVersion = schemaVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MessageSchemaReference() + { + } + + /// The message schema registry namespace. + public string SchemaRegistryNamespace { get; } + /// The message schema name. + public string SchemaName { get; } + /// The message schema version. + public string SchemaVersion { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.Serialization.cs new file mode 100644 index 000000000000..b7c7478fcfb5 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + internal partial class SchemaListResult : 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(SchemaListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchemaListResult 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(SchemaListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaListResult(document.RootElement, options); + } + + internal static SchemaListResult DeserializeSchemaListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchemaListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchemaListResult)} does not support writing '{options.Format}' format."); + } + } + + SchemaListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchemaListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchemaListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.cs new file mode 100644 index 000000000000..3d8a3357a74a --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The response of a Schema list operation. + internal partial class SchemaListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Schema items on this page. + /// is null. + internal SchemaListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Schema items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchemaListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchemaListResult() + { + } + + /// The Schema items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.Serialization.cs similarity index 54% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.Serialization.cs index 09f5be9b774c..5e1d1d358577 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - public partial class UserAuthenticationUpdate : IUtf8JsonSerializable, IJsonModel + internal partial class SchemaRegistryListResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,26 +28,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UserAuthenticationUpdate)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SchemaRegistryListResult)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Mode)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.Value.ToString()); + writer.WriteObjectValue(item, options); } - if (Optional.IsDefined(UsernamePasswordCredentials)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { - writer.WritePropertyName("usernamePasswordCredentials"u8); - writer.WriteObjectValue(UsernamePasswordCredentials, options); - } - if (Optional.IsDefined(X509Credentials)) - { - writer.WritePropertyName("x509Credentials"u8); - writer.WriteObjectValue(X509Credentials, options); + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UserAuthenticationUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SchemaRegistryListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UserAuthenticationUpdate)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SchemaRegistryListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUserAuthenticationUpdate(document.RootElement, options); + return DeserializeSchemaRegistryListResult(document.RootElement, options); } - internal static UserAuthenticationUpdate DeserializeUserAuthenticationUpdate(JsonElement element, ModelReaderWriterOptions options = null) + internal static SchemaRegistryListResult DeserializeSchemaRegistryListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,38 +83,29 @@ internal static UserAuthenticationUpdate DeserializeUserAuthenticationUpdate(Jso { return null; } - UserAuthenticationMode? mode = default; - UsernamePasswordCredentialsUpdate usernamePasswordCredentials = default; - X509CredentialsUpdate x509Credentials = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("mode"u8)) + if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - continue; - } - mode = new UserAuthenticationMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("usernamePasswordCredentials"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; + array.Add(DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(item, options)); } - usernamePasswordCredentials = UsernamePasswordCredentialsUpdate.DeserializeUsernamePasswordCredentialsUpdate(property.Value, options); + value = array; continue; } - if (property.NameEquals("x509Credentials"u8)) + if (property.NameEquals("nextLink"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - x509Credentials = X509CredentialsUpdate.DeserializeX509CredentialsUpdate(property.Value, options); + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -126,38 +114,38 @@ internal static UserAuthenticationUpdate DeserializeUserAuthenticationUpdate(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new UserAuthenticationUpdate(mode, usernamePasswordCredentials, x509Credentials, serializedAdditionalRawData); + return new SchemaRegistryListResult(value, nextLink, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(UserAuthenticationUpdate)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SchemaRegistryListResult)} does not support writing '{options.Format}' format."); } } - UserAuthenticationUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SchemaRegistryListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeUserAuthenticationUpdate(document.RootElement, options); + return DeserializeSchemaRegistryListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UserAuthenticationUpdate)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SchemaRegistryListResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.cs new file mode 100644 index 000000000000..dc15f9d75cf1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The response of a SchemaRegistry list operation. + internal partial class SchemaRegistryListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The SchemaRegistry items on this page. + /// is null. + internal SchemaRegistryListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SchemaRegistry items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchemaRegistryListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchemaRegistryListResult() + { + } + + /// The SchemaRegistry items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..4881a28a04bb --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft 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.DeviceRegistry.Models +{ + public partial class SchemaRegistryUpdateProperties : 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(SchemaRegistryUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchemaRegistryUpdateProperties 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(SchemaRegistryUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaRegistryUpdateProperties(document.RootElement, options); + } + + internal static SchemaRegistryUpdateProperties DeserializeSchemaRegistryUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchemaRegistryUpdateProperties(displayName, description, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchemaRegistryUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + SchemaRegistryUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchemaRegistryUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchemaRegistryUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.cs similarity index 61% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.cs index 83ba7d1e9ea2..525f5d5fb6ef 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UsernamePasswordCredentialsUpdate.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaRegistryUpdateProperties.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - /// The credentials for authentication mode UsernamePassword. - public partial class UsernamePasswordCredentialsUpdate + /// The updatable properties of the SchemaRegistry. + public partial class SchemaRegistryUpdateProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,25 +45,25 @@ public partial class UsernamePasswordCredentialsUpdate /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public UsernamePasswordCredentialsUpdate() + /// Initializes a new instance of . + public SchemaRegistryUpdateProperties() { } - /// Initializes a new instance of . - /// A reference to secret containing the username. - /// A reference to secret containing the password. + /// Initializes a new instance of . + /// Human-readable display name. + /// Human-readable description of the schema registry. /// Keeps track of any properties unknown to the library. - internal UsernamePasswordCredentialsUpdate(string usernameReference, string passwordReference, IDictionary serializedAdditionalRawData) + internal SchemaRegistryUpdateProperties(string displayName, string description, IDictionary serializedAdditionalRawData) { - UsernameReference = usernameReference; - PasswordReference = passwordReference; + DisplayName = displayName; + Description = description; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// A reference to secret containing the username. - public string UsernameReference { get; set; } - /// A reference to secret containing the password. - public string PasswordReference { get; set; } + /// Human-readable display name. + public string DisplayName { get; set; } + /// Human-readable description of the schema registry. + public string Description { get; set; } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.Serialization.cs similarity index 59% rename from sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.Serialization.cs rename to sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.Serialization.cs index 9945959dca2a..c7b4a19d0eaf 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.Serialization.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.DeviceRegistry.Models { - internal partial class TransportAuthentication : IUtf8JsonSerializable, IJsonModel + internal partial class SchemaVersionListResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,19 +28,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(TransportAuthentication)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SchemaVersionListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("ownCertificates"u8); + writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in OwnCertificates) + foreach (var item in Value) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -58,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - TransportAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SchemaVersionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(TransportAuthentication)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SchemaVersionListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTransportAuthentication(document.RootElement, options); + return DeserializeSchemaVersionListResult(document.RootElement, options); } - internal static TransportAuthentication DeserializeTransportAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + internal static SchemaVersionListResult DeserializeSchemaVersionListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -78,19 +83,29 @@ internal static TransportAuthentication DeserializeTransportAuthentication(JsonE { return null; } - IList ownCertificates = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("ownCertificates"u8)) + if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(OwnCertificate.DeserializeOwnCertificate(item, options)); + array.Add(DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; } - ownCertificates = array; + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -99,38 +114,38 @@ internal static TransportAuthentication DeserializeTransportAuthentication(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new TransportAuthentication(ownCertificates, serializedAdditionalRawData); + return new SchemaVersionListResult(value, nextLink, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(TransportAuthentication)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SchemaVersionListResult)} does not support writing '{options.Format}' format."); } } - TransportAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SchemaVersionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeTransportAuthentication(document.RootElement, options); + return DeserializeSchemaVersionListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(TransportAuthentication)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SchemaVersionListResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.cs new file mode 100644 index 000000000000..66fd4612a901 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/SchemaVersionListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DeviceRegistry.Models +{ + /// The response of a SchemaVersion list operation. + internal partial class SchemaVersionListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The SchemaVersion items on this page. + /// is null. + internal SchemaVersionListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SchemaVersion items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchemaVersionListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchemaVersionListResult() + { + } + + /// The SchemaVersion items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.cs deleted file mode 100644 index 565d91f512af..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/TransportAuthentication.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - /// Definition of the authentication mechanism for the southbound connector. - internal partial class TransportAuthentication - { - /// - /// 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 . - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - /// is null. - public TransportAuthentication(IEnumerable ownCertificates) - { - Argument.AssertNotNull(ownCertificates, nameof(ownCertificates)); - - OwnCertificates = ownCertificates.ToList(); - } - - /// Initializes a new instance of . - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - /// Keeps track of any properties unknown to the library. - internal TransportAuthentication(IList ownCertificates, IDictionary serializedAdditionalRawData) - { - OwnCertificates = ownCertificates; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal TransportAuthentication() - { - } - - /// Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. - public IList OwnCertificates { get; } - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationMode.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationMode.cs deleted file mode 100644 index 410c606aa2b5..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationMode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - /// Defines the mode to authenticate the user of the client at the server. - public readonly partial struct UserAuthenticationMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public UserAuthenticationMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AnonymousValue = "Anonymous"; - private const string CertificateValue = "Certificate"; - private const string UsernamePasswordValue = "UsernamePassword"; - - /// The user authentication mode is anonymous. - public static UserAuthenticationMode Anonymous { get; } = new UserAuthenticationMode(AnonymousValue); - /// The user authentication mode is an x509 certificate. - public static UserAuthenticationMode Certificate { get; } = new UserAuthenticationMode(CertificateValue); - /// The user authentication mode is a username and password. - public static UserAuthenticationMode UsernamePassword { get; } = new UserAuthenticationMode(UsernamePasswordValue); - /// Determines if two values are the same. - public static bool operator ==(UserAuthenticationMode left, UserAuthenticationMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(UserAuthenticationMode left, UserAuthenticationMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator UserAuthenticationMode(string value) => new UserAuthenticationMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is UserAuthenticationMode other && Equals(other); - /// - public bool Equals(UserAuthenticationMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.cs deleted file mode 100644 index 44bb33e150a4..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/UserAuthenticationUpdate.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - /// Definition of the client authentication mechanism to the server. - public partial class UserAuthenticationUpdate - { - /// - /// 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 UserAuthenticationUpdate() - { - } - - /// Initializes a new instance of . - /// Defines the mode to authenticate the user of the client at the server. - /// Defines the username and password references when UsernamePassword user authentication mode is selected. - /// Defines the certificate reference when Certificate user authentication mode is selected. - /// Keeps track of any properties unknown to the library. - internal UserAuthenticationUpdate(UserAuthenticationMode? mode, UsernamePasswordCredentialsUpdate usernamePasswordCredentials, X509CredentialsUpdate x509Credentials, IDictionary serializedAdditionalRawData) - { - Mode = mode; - UsernamePasswordCredentials = usernamePasswordCredentials; - X509Credentials = x509Credentials; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Defines the mode to authenticate the user of the client at the server. - public UserAuthenticationMode? Mode { get; set; } - /// Defines the username and password references when UsernamePassword user authentication mode is selected. - public UsernamePasswordCredentialsUpdate UsernamePasswordCredentials { get; set; } - /// Defines the certificate reference when Certificate user authentication mode is selected. - internal X509CredentialsUpdate X509Credentials { get; set; } - /// A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - public string X509CredentialsCertificateReference - { - get => X509Credentials is null ? default : X509Credentials.CertificateReference; - set - { - if (X509Credentials is null) - X509Credentials = new X509CredentialsUpdate(); - X509Credentials.CertificateReference = value; - } - } - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.Serialization.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.Serialization.cs deleted file mode 100644 index 09bd44e51ca4..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/Models/X509Credentials.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.DeviceRegistry.Models -{ - internal partial class X509Credentials : 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(X509Credentials)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("certificateReference"u8); - writer.WriteStringValue(CertificateReference); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - X509Credentials 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(X509Credentials)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeX509Credentials(document.RootElement, options); - } - - internal static X509Credentials DeserializeX509Credentials(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string certificateReference = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("certificateReference"u8)) - { - certificateReference = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new X509Credentials(certificateReference, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(X509Credentials)} does not support writing '{options.Format}' format."); - } - } - - X509Credentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeX509Credentials(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(X509Credentials)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetEndpointProfilesRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetEndpointProfilesRestOperations.cs index 210440453682..dde0609678c6 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetEndpointProfilesRestOperations.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetEndpointProfilesRestOperations.cs @@ -25,181 +25,17 @@ internal partial class AssetEndpointProfilesRestOperations /// Initializes a new instance of AssetEndpointProfilesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public AssetEndpointProfilesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-11-01-preview"; + _apiVersion = apiVersion ?? "2024-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List AssetEndpointProfile resources by subscription ID. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AssetEndpointProfileListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List AssetEndpointProfile resources by subscription ID. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AssetEndpointProfileListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List AssetEndpointProfile resources by resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AssetEndpointProfileListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List AssetEndpointProfile resources by resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AssetEndpointProfileListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string assetEndpointProfileName) { var uri = new RawRequestUriBuilder(); @@ -235,7 +71,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The cancellation token to use. @@ -266,7 +102,7 @@ public async Task> GetAsync(str } /// Get a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The cancellation token to use. @@ -335,7 +171,7 @@ internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string } /// Create a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// Resource create parameters. @@ -362,7 +198,7 @@ public async Task CreateOrReplaceAsync(string subscriptionId, string r } /// Create a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// Resource create parameters. @@ -427,7 +263,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The resource properties to be updated. @@ -454,7 +290,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The resource properties to be updated. @@ -515,7 +351,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The cancellation token to use. @@ -540,7 +376,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete a AssetEndpointProfile. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset Endpoint Profile name parameter. /// The cancellation token to use. @@ -564,22 +400,114 @@ public Response Delete(string subscriptionId, string resourceGroupName, string a } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AssetEndpointProfile resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AssetEndpointProfile resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -587,17 +515,15 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st } /// List AssetEndpointProfile resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -614,17 +540,15 @@ public async Task> ListBySubscriptionNe } /// List AssetEndpointProfile resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -664,7 +588,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List AssetEndpointProfile resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -693,7 +617,7 @@ public async Task> ListByResourceGroupN /// List AssetEndpointProfile resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -719,5 +643,81 @@ public Response ListByResourceGroupNextPage(stri throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AssetEndpointProfile resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AssetEndpointProfile resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AssetEndpointProfileListResult.DeserializeAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetsRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetsRestOperations.cs index 5915b8dd6768..de8b3c8894e3 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetsRestOperations.cs +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/AssetsRestOperations.cs @@ -25,181 +25,17 @@ internal partial class AssetsRestOperations /// Initializes a new instance of AssetsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public AssetsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-11-01-preview"; + _apiVersion = apiVersion ?? "2024-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List Asset resources by subscription ID. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AssetListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AssetListResult.DeserializeAssetListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List Asset resources by subscription ID. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AssetListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AssetListResult.DeserializeAssetListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List Asset resources by resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AssetListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AssetListResult.DeserializeAssetListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List Asset resources by resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AssetListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AssetListResult.DeserializeAssetListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string assetName) { var uri = new RawRequestUriBuilder(); @@ -235,7 +71,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The cancellation token to use. @@ -266,7 +102,7 @@ public async Task> GetAsync(string subscriptio } /// Get a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The cancellation token to use. @@ -335,7 +171,7 @@ internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string } /// Create a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// Resource create parameters. @@ -362,7 +198,7 @@ public async Task CreateOrReplaceAsync(string subscriptionId, string r } /// Create a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// Resource create parameters. @@ -427,7 +263,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The resource properties to be updated. @@ -454,7 +290,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The resource properties to be updated. @@ -515,7 +351,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The cancellation token to use. @@ -540,7 +376,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete a Asset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Asset name parameter. /// The cancellation token to use. @@ -564,22 +400,114 @@ public Response Delete(string subscriptionId, string resourceGroupName, string a } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Asset resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AssetListResult.DeserializeAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Asset resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AssetListResult.DeserializeAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/assets", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -587,17 +515,15 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st } /// List Asset resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -614,17 +540,15 @@ public async Task> ListBySubscriptionNextPageAsync(str } /// List Asset resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -664,7 +588,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List Asset resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -693,7 +617,7 @@ public async Task> ListByResourceGroupNextPageAsync(st /// List Asset resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -719,5 +643,81 @@ public Response ListByResourceGroupNextPage(string nextLink, st throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Asset resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AssetListResult.DeserializeAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Asset resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AssetListResult.DeserializeAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/BillingContainersRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/BillingContainersRestOperations.cs new file mode 100644 index 000000000000..c6239c813952 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/BillingContainersRestOperations.cs @@ -0,0 +1,281 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class BillingContainersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BillingContainersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public BillingContainersRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string billingContainerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/billingContainers/", false); + uri.AppendPath(billingContainerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string billingContainerName) + { + 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.DeviceRegistry/billingContainers/", false); + uri.AppendPath(billingContainerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BillingContainer. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the billing container. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var message = CreateGetRequest(subscriptionId, billingContainerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryBillingContainerData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistryBillingContainerData.DeserializeDeviceRegistryBillingContainerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryBillingContainerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BillingContainer. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the billing container. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string billingContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(billingContainerName, nameof(billingContainerName)); + + using var message = CreateGetRequest(subscriptionId, billingContainerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryBillingContainerData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistryBillingContainerData.DeserializeDeviceRegistryBillingContainerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryBillingContainerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/billingContainers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/billingContainers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BillingContainer resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BillingContainerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BillingContainerListResult.DeserializeBillingContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BillingContainer resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BillingContainerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BillingContainerListResult.DeserializeBillingContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BillingContainer resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BillingContainerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BillingContainerListResult.DeserializeBillingContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BillingContainer resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BillingContainerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BillingContainerListResult.DeserializeBillingContainerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetEndpointProfilesRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetEndpointProfilesRestOperations.cs new file mode 100644 index 000000000000..5859b759be61 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetEndpointProfilesRestOperations.cs @@ -0,0 +1,723 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class DiscoveredAssetEndpointProfilesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DiscoveredAssetEndpointProfilesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DiscoveredAssetEndpointProfilesRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryDiscoveredAssetEndpointProfileData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryDiscoveredAssetEndpointProfileData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryDiscoveredAssetEndpointProfileData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistryDiscoveredAssetEndpointProfileData.DeserializeDeviceRegistryDiscoveredAssetEndpointProfileData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryDiscoveredAssetEndpointProfileData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrReplaceRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrReplaceAsync(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrReplace(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfileData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, DeviceRegistryDiscoveredAssetEndpointProfilePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/", false); + uri.AppendPath(discoveredAssetEndpointProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DiscoveredAssetEndpointProfile. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset Endpoint Profile name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string discoveredAssetEndpointProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetEndpointProfileName, nameof(discoveredAssetEndpointProfileName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, discoveredAssetEndpointProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAssetEndpointProfile resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAssetEndpointProfile resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAssetEndpointProfile resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAssetEndpointProfile resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAssetEndpointProfile resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAssetEndpointProfile resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAssetEndpointProfile resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAssetEndpointProfile resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetEndpointProfileListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetEndpointProfileListResult.DeserializeDiscoveredAssetEndpointProfileListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetsRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetsRestOperations.cs new file mode 100644 index 000000000000..839b478826a1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/DiscoveredAssetsRestOperations.cs @@ -0,0 +1,723 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class DiscoveredAssetsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DiscoveredAssetsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DiscoveredAssetsRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string discoveredAssetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, discoveredAssetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryDiscoveredAssetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryDiscoveredAssetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, discoveredAssetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistryDiscoveredAssetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistryDiscoveredAssetData.DeserializeDeviceRegistryDiscoveredAssetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistryDiscoveredAssetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrReplaceRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrReplaceAsync(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, discoveredAssetName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrReplace(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, discoveredAssetName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, discoveredAssetName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string discoveredAssetName, DeviceRegistryDiscoveredAssetPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, discoveredAssetName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string discoveredAssetName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string discoveredAssetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets/", false); + uri.AppendPath(discoveredAssetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, discoveredAssetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DiscoveredAsset. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Discovered Asset name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string discoveredAssetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(discoveredAssetName, nameof(discoveredAssetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, discoveredAssetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAsset resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAsset resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/discoveredAssets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAsset resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAsset resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAsset resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAsset resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DiscoveredAsset resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DiscoveredAsset resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DiscoveredAssetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DiscoveredAssetListResult.DeserializeDiscoveredAssetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaRegistriesRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaRegistriesRestOperations.cs new file mode 100644 index 000000000000..93ef9b14a942 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaRegistriesRestOperations.cs @@ -0,0 +1,723 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class SchemaRegistriesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SchemaRegistriesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SchemaRegistriesRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaRegistryData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaRegistryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaRegistryData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistrySchemaRegistryData.DeserializeDeviceRegistrySchemaRegistryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaRegistryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrReplaceRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrReplaceAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrReplace(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schemaRegistryName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string schemaRegistryName, DeviceRegistrySchemaRegistryPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schemaRegistryName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaRegistry resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaRegistry resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaRegistry resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaRegistry resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaRegistry resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaRegistry resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaRegistry resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaRegistry resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaRegistryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaRegistryListResult.DeserializeSchemaRegistryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaVersionsRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaVersionsRestOperations.cs new file mode 100644 index 000000000000..30a08ad23e0b --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemaVersionsRestOperations.cs @@ -0,0 +1,559 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class SchemaVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SchemaVersionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SchemaVersionsRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrReplaceRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, DeviceRegistrySchemaVersionData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, DeviceRegistrySchemaVersionData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrReplaceAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DeviceRegistrySchemaVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrReplace(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, DeviceRegistrySchemaVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DeviceRegistrySchemaVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistrySchemaVersionData.DeserializeDeviceRegistrySchemaVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions/", false); + uri.AppendPath(schemaVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a SchemaVersion. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Schema version name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, string schemaVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNullOrEmpty(schemaVersionName, nameof(schemaVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchemaRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySchemaRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/schemaVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaVersion resources by Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchemaAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateListBySchemaRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaVersionListResult.DeserializeSchemaVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaVersion resources by Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListBySchema(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateListBySchemaRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaVersionListResult.DeserializeSchemaVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchemaNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySchemaNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SchemaVersion resources by Schema. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchemaNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateListBySchemaNextPageRequest(nextLink, subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaVersionListResult.DeserializeSchemaVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SchemaVersion resources by Schema. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListBySchemaNextPage(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateListBySchemaNextPageRequest(nextLink, subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaVersionListResult.DeserializeSchemaVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemasRestOperations.cs b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemasRestOperations.cs new file mode 100644 index 000000000000..572b8b04aaf1 --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/Generated/RestOperations/SchemasRestOperations.cs @@ -0,0 +1,523 @@ +// 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.DeviceRegistry.Models; + +namespace Azure.ResourceManager.DeviceRegistry +{ + internal partial class SchemasRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SchemasRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SchemasRestOperations(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 ?? "2024-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeviceRegistrySchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DeviceRegistrySchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrReplaceRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, DeviceRegistrySchemaData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, DeviceRegistrySchemaData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrReplaceAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DeviceRegistrySchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrReplace(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, DeviceRegistrySchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrReplaceRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DeviceRegistrySchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeviceRegistrySchemaData.DeserializeDeviceRegistrySchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// Schema name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string schemaRegistryName, string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schemaRegistryName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchemaRegistryRequestUri(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySchemaRegistryRequest(string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DeviceRegistry/schemaRegistries/", false); + uri.AppendPath(schemaRegistryName, true); + uri.AppendPath("/schemas", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schema resources by SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchemaRegistryAsync(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateListBySchemaRegistryRequest(subscriptionId, resourceGroupName, schemaRegistryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schema resources by SchemaRegistry. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySchemaRegistry(string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateListBySchemaRegistryRequest(subscriptionId, resourceGroupName, schemaRegistryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchemaRegistryNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySchemaRegistryNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schema resources by SchemaRegistry. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchemaRegistryNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateListBySchemaRegistryNextPageRequest(nextLink, subscriptionId, resourceGroupName, schemaRegistryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schema resources by SchemaRegistry. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Schema registry name parameter. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySchemaRegistryNextPage(string nextLink, string subscriptionId, string resourceGroupName, string schemaRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schemaRegistryName, nameof(schemaRegistryName)); + + using var message = CreateListBySchemaRegistryNextPageRequest(nextLink, subscriptionId, resourceGroupName, schemaRegistryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/autorest.md b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/autorest.md deleted file mode 100644 index ff3ea9e5901e..000000000000 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/src/autorest.md +++ /dev/null @@ -1,67 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml -azure-arm: true -csharp: true -library-name: DeviceRegistry -namespace: Azure.ResourceManager.DeviceRegistry -require: https://github.com/Azure/azure-rest-api-specs/blob/9549a0e63c97d766ddadd56c71b4ad04c096dd3f/specification/deviceregistry/resource-manager/readme.md -#tag: package-preview-2023-11 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -#mgmt-debug: -# show-serialized-names: true - -rename-mapping: - Event: AssetEvent - -prepend-rp-prefix: - - Asset - - AssetEndpointProfile - - ExtendedLocation - - ProvisioningState - -format-by-name-rules: - 'tenantId': 'uuid' - 'ETag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - -directive: - - remove-operation: 'OperationStatus_Get' - -``` diff --git a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml new file mode 100644 index 000000000000..527ae11fe3bd --- /dev/null +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/deviceregistry/DeviceRegistry.Management +commit: 60c791f3c818acc8ba2b522b956e9ed3b0794937 +repo: Azure/azure-rest-api-specs +additionalDirectories: