diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs similarity index 94% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs rename to sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs index dc427b7c7993b..0d44251e00d73 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs +++ b/sdk/resourcemanager/Proto.Client/billing/TrackedResource.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Core.Adapters /// /// The type of the underlying resource id /// The type of the underlying model this class wraps - public abstract class TrackedResource : TrackedResource + public abstract class TrackedResource : TrackedResource where TIdentifier : TenantResourceIdentifier where TModel : class { @@ -19,7 +19,7 @@ public abstract class TrackedResource : TrackedResource The location of the resource. /// The model to copy from. protected TrackedResource(TIdentifier id, LocationData location, TModel data) - :base(id, id?.Name, id?.ResourceType, location, null) + : base(id, id?.Name, id?.ResourceType, location, null) { Model = data; } diff --git a/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs new file mode 100644 index 0000000000000..0d44251e00d73 --- /dev/null +++ b/sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.ResourceManager.Core.Adapters +{ + /// + /// A class representing a generic tracked resource in Azure. + /// + /// The type of the underlying resource id + /// The type of the underlying model this class wraps + public abstract class TrackedResource : TrackedResource + where TIdentifier : TenantResourceIdentifier + where TModel : class + { + /// + /// Initializes a new instance of the class. + /// + /// The identifier of the resource that is the target of operations. + /// The location of the resource. + /// The model to copy from. + protected TrackedResource(TIdentifier id, LocationData location, TModel data) + : base(id, id?.Name, id?.ResourceType, location, null) + { + Model = data; + } + + /// + /// Gets or sets the Model this resource is based off. + /// + public virtual TModel Model { get; set; } + + /// + /// Converts from a into the TModel. + /// + /// The tracked resource convert from. + public static implicit operator TModel(TrackedResource other) + { + return other.Model; + } + } +} diff --git a/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs b/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs new file mode 100644 index 0000000000000..0d44251e00d73 --- /dev/null +++ b/sdk/resourcemanager/Proto.Client/network/TrackedResource.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.ResourceManager.Core.Adapters +{ + /// + /// A class representing a generic tracked resource in Azure. + /// + /// The type of the underlying resource id + /// The type of the underlying model this class wraps + public abstract class TrackedResource : TrackedResource + where TIdentifier : TenantResourceIdentifier + where TModel : class + { + /// + /// Initializes a new instance of the class. + /// + /// The identifier of the resource that is the target of operations. + /// The location of the resource. + /// The model to copy from. + protected TrackedResource(TIdentifier id, LocationData location, TModel data) + : base(id, id?.Name, id?.ResourceType, location, null) + { + Model = data; + } + + /// + /// Gets or sets the Model this resource is based off. + /// + public virtual TModel Model { get; set; } + + /// + /// Converts from a into the TModel. + /// + /// The tracked resource convert from. + public static implicit operator TModel(TrackedResource other) + { + return other.Model; + } + } +}