From 1ebd68b9a1fbeb6aa0211e6f0207befcde912bb2 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Mon, 17 Mar 2025 04:09:50 -0500 Subject: [PATCH 1/8] Replaced use of [Obsolete] to mark preview functionality with the [RequiresPreviewFeatures] attribute where relevant Signed-off-by: Whit Waldo --- .../dotnet-sdk-docs/dotnet-client/_index.md | 2 +- .../Controllers/BindingController.cs | 7 +-- src/Dapr.Client/DaprClient.cs | 44 +++++++++---------- src/Dapr.Client/DaprClientGrpc.cs | 38 +++++++--------- src/Dapr.Client/TryLockResponse.cs | 3 +- src/Dapr.Jobs/DaprJobsClient.cs | 8 ++-- src/Dapr.Jobs/DaprJobsGrpcClient.cs | 7 +-- .../Extensions/DaprSerializationExtensions.cs | 5 ++- 8 files changed, 55 insertions(+), 59 deletions(-) diff --git a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md index 93af91c4f..0252fe885 100644 --- a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md +++ b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md @@ -236,7 +236,7 @@ namespace LockService { class Program { - [Obsolete("Distributed Lock API is in Alpha, this can be removed once it is stable.")] + [Experimental("Distributed Lock API is in Alpha, this can be removed once it is stable.")] static async Task Main(string[] args) { var daprLockName = "lockstore"; diff --git a/examples/Client/DistributedLock/Controllers/BindingController.cs b/examples/Client/DistributedLock/Controllers/BindingController.cs index aa4dd1f52..de68e4147 100644 --- a/examples/Client/DistributedLock/Controllers/BindingController.cs +++ b/examples/Client/DistributedLock/Controllers/BindingController.cs @@ -1,5 +1,7 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Runtime.Versioning; using System.Text.Json; using System.Threading.Tasks; using Dapr; @@ -25,7 +27,7 @@ public BindingController(DaprClient client, ILogger logger) } [HttpPost("cronbinding")] - [Obsolete] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public async Task HandleBindingEvent() { logger.LogInformation($"Received binding event on {appId}, scanning for work."); @@ -47,8 +49,7 @@ public async Task HandleBindingEvent() return Ok(); } - - [Obsolete] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] private async Task AttemptToProcessFile(string fileName) { // Locks are Disposable and will automatically unlock at the end of a 'using' statement. diff --git a/src/Dapr.Client/DaprClient.cs b/src/Dapr.Client/DaprClient.cs index 6be31a648..976585944 100644 --- a/src/Dapr.Client/DaprClient.cs +++ b/src/Dapr.Client/DaprClient.cs @@ -18,6 +18,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; +using System.Runtime.Versioning; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -1090,7 +1091,7 @@ public abstract Task UnsubscribeConfiguration( /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1104,7 +1105,7 @@ public abstract Task> EncryptAsync(string vaultResourceName /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1117,7 +1118,7 @@ public abstract Task>> EncryptAsync(string /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1129,7 +1130,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default); @@ -1142,8 +1143,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1155,8 +1155,7 @@ public abstract Task>> DecryptAsync(string /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default); @@ -1172,7 +1171,7 @@ public abstract Task>> DecryptAsync(string ///// The format to use for the key result. ///// A that can be used to cancel the operation. ///// The name (and possibly version as name/version) of the key and its public key. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default); @@ -1187,7 +1186,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1207,7 +1206,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the nonce. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1230,7 +1229,7 @@ public abstract Task>> DecryptAsync(string ///// ///// Any associated data when using AEAD ciphers. ///// The array of plaintext bytes. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1246,8 +1245,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value used. ///// ///// The array of plaintext bytes. - //[Obsolete( - // "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, CancellationToken cancellationToken = default) => // await DecryptAsync(vaultResourceName, cipherTextBytes, algorithm, keyName, nonce, tag, Array.Empty(), cancellationToken); @@ -1263,7 +1261,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the wrapped plain-text key and the authentication tag, if applicable. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, byte[] nonce, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1277,7 +1275,7 @@ public abstract Task>> DecryptAsync(string ///// The none used. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key and the authentication tag, if applicable. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, // byte[] nonce, CancellationToken cancellationToken = default) => await WrapKeyAsync(vaultResourceName, plainTextKey, // keyName, algorithm, nonce, Array.Empty(), cancellationToken); @@ -1294,7 +1292,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1309,7 +1307,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the authentication tag. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, byte[] tag, // CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, @@ -1325,7 +1323,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, // wrappedKey, algorithm, keyName, nonce, Array.Empty(), Array.Empty(), cancellationToken); @@ -1339,7 +1337,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// The bytes comprising the signature. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1353,7 +1351,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// True if the signature verification is successful; otherwise false. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public abstract Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1368,7 +1366,7 @@ public abstract Task>> DecryptAsync(string /// The time after which the lock gets expired. /// A that can be used to cancel the operation. /// A containing a - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task Lock( string storeName, string resourceId, @@ -1385,7 +1383,7 @@ public abstract Task Lock( /// Indicates the identifier of lock owner. /// A that can be used to cancel the operation. /// A containing a - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/DaprClientGrpc.cs b/src/Dapr.Client/DaprClientGrpc.cs index 394b313e2..55d6729eb 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -11,7 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ -using Dapr.Common.Extensions; +using System.Runtime.Versioning; namespace Dapr.Client; @@ -1664,8 +1664,7 @@ public override async Task UnsubscribeConfigur #region Cryptography /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1685,8 +1684,7 @@ public override async Task> EncryptAsync(string vaultResour } /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1787,8 +1785,7 @@ private async IAsyncEnumerable> RetrieveEncryptedStreamAsyn } /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1819,8 +1816,7 @@ public override async Task>> DecryptAsync( } /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default) => DecryptAsync(vaultResourceName, ciphertextStream, keyName, new DecryptionOptions(), @@ -1883,8 +1879,7 @@ private async IAsyncEnumerable> RetrieveDecryptedStreamAsyn } /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1904,8 +1899,7 @@ public override async Task> DecryptAsync(string vaultResour } /// - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default) => await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, @@ -1914,7 +1908,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Subtle Crypto Implementation ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, Autogenerated.SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default) //{ @@ -1943,7 +1937,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync(string vaultResourceName, byte[] plainTextBytes, string algorithm, // string keyName, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -1979,7 +1973,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, string algorithm, string keyName, byte[] nonce, byte[] tag, // byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2015,7 +2009,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, // string algorithm, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2051,7 +2045,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, // string keyName, byte[] nonce, byte[] tag, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2088,7 +2082,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, CancellationToken cancellationToken = default) //{ // ArgumentVerifier.ThrowIfNullOrEmpty(vaultResourceName, nameof(vaultResourceName)); @@ -2121,7 +2115,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] //public override async Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, // string algorithm, string keyName, CancellationToken cancellationToken = default) //{ @@ -2163,7 +2157,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Distributed Lock API /// - [Obsolete] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public async override Task Lock( string storeName, string resourceId, @@ -2203,7 +2197,7 @@ public async override Task Lock( } /// - [Obsolete] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public async override Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/TryLockResponse.cs b/src/Dapr.Client/TryLockResponse.cs index e9057fbb4..12680615b 100644 --- a/src/Dapr.Client/TryLockResponse.cs +++ b/src/Dapr.Client/TryLockResponse.cs @@ -12,6 +12,7 @@ // ------------------------------------------------------------------------ using System; +using System.Runtime.Versioning; using System.Threading.Tasks; namespace Dapr.Client @@ -19,7 +20,7 @@ namespace Dapr.Client /// /// Class representing the response from a Lock API call. /// - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public sealed class TryLockResponse : IAsyncDisposable { /// diff --git a/src/Dapr.Jobs/DaprJobsClient.cs b/src/Dapr.Jobs/DaprJobsClient.cs index 4dd4abd70..ff1348faf 100644 --- a/src/Dapr.Jobs/DaprJobsClient.cs +++ b/src/Dapr.Jobs/DaprJobsClient.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Runtime.Versioning; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; @@ -45,8 +46,7 @@ public abstract class DaprJobsClient : IDisposable /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -58,7 +58,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// The jobName of the job. /// Cancellation token. /// The details comprising the job. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task GetJobAsync(string jobName, CancellationToken cancellationToken = default); /// @@ -66,7 +66,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// /// The jobName of the job. /// Cancellation token. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public abstract Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default); internal static KeyValuePair? GetDaprApiTokenHeader(string apiToken) diff --git a/src/Dapr.Jobs/DaprJobsGrpcClient.cs b/src/Dapr.Jobs/DaprJobsGrpcClient.cs index 8743aa350..d58c54809 100644 --- a/src/Dapr.Jobs/DaprJobsGrpcClient.cs +++ b/src/Dapr.Jobs/DaprJobsGrpcClient.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Runtime.Versioning; using Dapr.Common; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; @@ -68,7 +69,7 @@ internal DaprJobsGrpcClient( /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -150,7 +151,7 @@ public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule sche /// The name of the job. /// Cancellation token. /// The details comprising the job. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task GetJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) @@ -198,7 +199,7 @@ public override async Task GetJobAsync(string jobName, Cancellat /// The name of the job. /// Cancellation token. /// - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public override async Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) diff --git a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs index 1f02a32cd..12d331353 100644 --- a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs +++ b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Runtime.Versioning; using System.Text; using System.Text.Json; using Dapr.Jobs.Models; @@ -39,7 +40,7 @@ public static class DaprJobsSerializationExtensions /// Optional JSON serialization options. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, object payload, DateTime? startingFrom = null, int? repeats = null, JsonSerializerOptions? jsonSerializerOptions = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) @@ -64,7 +65,7 @@ public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, string payload, DateTime? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) From 126be526fb24d496cbb2e43163dca0f6cce8b5cc Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Mon, 17 Mar 2025 04:14:46 -0500 Subject: [PATCH 2/8] Replaced use of [Experimental] attribute with [RequiresPreviewFeatures] Signed-off-by: Whit Waldo --- daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md index 0252fe885..6d5a55d32 100644 --- a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md +++ b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md @@ -230,13 +230,14 @@ await foreach (var items in subscribeConfigurationResponse.Source.WithCancellati ```csharp using System; +using System.Runtime.Versioning; using Dapr.Client; namespace LockService { class Program { - [Experimental("Distributed Lock API is in Alpha, this can be removed once it is stable.")] + [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] static async Task Main(string[] args) { var daprLockName = "lockstore"; From 64a420d2c558c28ab71a7079d488c3fc06a3bf7d Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 18 Mar 2025 10:16:51 -0500 Subject: [PATCH 3/8] Swapped over all [RequiresPreviewFeature] attributes to use [Experimental] instead Signed-off-by: Whit Waldo --- .../Controllers/BindingController.cs | 5 +-- src/Dapr.Client/DaprClient.cs | 41 ++++++++++--------- src/Dapr.Client/DaprClientGrpc.cs | 31 +++++++------- src/Dapr.Client/TryLockResponse.cs | 3 +- src/Dapr.Jobs/DaprJobsClient.cs | 7 ++-- src/Dapr.Jobs/DaprJobsGrpcClient.cs | 7 ++-- .../Extensions/DaprSerializationExtensions.cs | 5 ++- 7 files changed, 52 insertions(+), 47 deletions(-) diff --git a/examples/Client/DistributedLock/Controllers/BindingController.cs b/examples/Client/DistributedLock/Controllers/BindingController.cs index de68e4147..0f8dc3d26 100644 --- a/examples/Client/DistributedLock/Controllers/BindingController.cs +++ b/examples/Client/DistributedLock/Controllers/BindingController.cs @@ -26,8 +26,7 @@ public BindingController(DaprClient client, ILogger logger) this.appId = Environment.GetEnvironmentVariable("APP_ID"); } - [HttpPost("cronbinding")] - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public async Task HandleBindingEvent() { logger.LogInformation($"Received binding event on {appId}, scanning for work."); @@ -49,7 +48,7 @@ public async Task HandleBindingEvent() return Ok(); } - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] private async Task AttemptToProcessFile(string fileName) { // Locks are Disposable and will automatically unlock at the end of a 'using' statement. diff --git a/src/Dapr.Client/DaprClient.cs b/src/Dapr.Client/DaprClient.cs index 976585944..88a493bcb 100644 --- a/src/Dapr.Client/DaprClient.cs +++ b/src/Dapr.Client/DaprClient.cs @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Net.Http; @@ -1091,7 +1092,7 @@ public abstract Task UnsubscribeConfiguration( /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1105,7 +1106,7 @@ public abstract Task> EncryptAsync(string vaultResourceName /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1118,7 +1119,7 @@ public abstract Task>> EncryptAsync(string /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1130,7 +1131,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default); @@ -1143,7 +1144,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1155,7 +1156,7 @@ public abstract Task>> DecryptAsync(string /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default); @@ -1171,7 +1172,7 @@ public abstract Task>> DecryptAsync(string ///// The format to use for the key result. ///// A that can be used to cancel the operation. ///// The name (and possibly version as name/version) of the key and its public key. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default); @@ -1186,7 +1187,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1206,7 +1207,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the nonce. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1229,7 +1230,7 @@ public abstract Task>> DecryptAsync(string ///// ///// Any associated data when using AEAD ciphers. ///// The array of plaintext bytes. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1245,7 +1246,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value used. ///// ///// The array of plaintext bytes. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, CancellationToken cancellationToken = default) => // await DecryptAsync(vaultResourceName, cipherTextBytes, algorithm, keyName, nonce, tag, Array.Empty(), cancellationToken); @@ -1261,7 +1262,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the wrapped plain-text key and the authentication tag, if applicable. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, byte[] nonce, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1275,7 +1276,7 @@ public abstract Task>> DecryptAsync(string ///// The none used. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key and the authentication tag, if applicable. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, // byte[] nonce, CancellationToken cancellationToken = default) => await WrapKeyAsync(vaultResourceName, plainTextKey, // keyName, algorithm, nonce, Array.Empty(), cancellationToken); @@ -1292,7 +1293,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1307,7 +1308,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the authentication tag. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, byte[] tag, // CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, @@ -1323,7 +1324,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, // wrappedKey, algorithm, keyName, nonce, Array.Empty(), Array.Empty(), cancellationToken); @@ -1337,7 +1338,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// The bytes comprising the signature. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1351,7 +1352,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// True if the signature verification is successful; otherwise false. - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public abstract Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1366,7 +1367,7 @@ public abstract Task>> DecryptAsync(string /// The time after which the lock gets expired. /// A that can be used to cancel the operation. /// A containing a - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task Lock( string storeName, string resourceId, @@ -1383,7 +1384,7 @@ public abstract Task Lock( /// Indicates the identifier of lock owner. /// A that can be used to cancel the operation. /// A containing a - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/DaprClientGrpc.cs b/src/Dapr.Client/DaprClientGrpc.cs index 55d6729eb..c876a8640 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; namespace Dapr.Client; @@ -1664,7 +1665,7 @@ public override async Task UnsubscribeConfigur #region Cryptography /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1684,7 +1685,7 @@ public override async Task> EncryptAsync(string vaultResour } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1785,7 +1786,7 @@ private async IAsyncEnumerable> RetrieveEncryptedStreamAsyn } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1816,7 +1817,7 @@ public override async Task>> DecryptAsync( } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default) => DecryptAsync(vaultResourceName, ciphertextStream, keyName, new DecryptionOptions(), @@ -1879,7 +1880,7 @@ private async IAsyncEnumerable> RetrieveDecryptedStreamAsyn } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1899,7 +1900,7 @@ public override async Task> DecryptAsync(string vaultResour } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default) => await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, @@ -1908,7 +1909,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Subtle Crypto Implementation ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, Autogenerated.SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default) //{ @@ -1937,7 +1938,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync(string vaultResourceName, byte[] plainTextBytes, string algorithm, // string keyName, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -1973,7 +1974,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, string algorithm, string keyName, byte[] nonce, byte[] tag, // byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2009,7 +2010,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, // string algorithm, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2045,7 +2046,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, // string keyName, byte[] nonce, byte[] tag, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2082,7 +2083,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, CancellationToken cancellationToken = default) //{ // ArgumentVerifier.ThrowIfNullOrEmpty(vaultResourceName, nameof(vaultResourceName)); @@ -2115,7 +2116,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental("DAPR10001")] //public override async Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, // string algorithm, string keyName, CancellationToken cancellationToken = default) //{ @@ -2157,7 +2158,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Distributed Lock API /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public async override Task Lock( string storeName, string resourceId, @@ -2197,7 +2198,7 @@ public async override Task Lock( } /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public async override Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/TryLockResponse.cs b/src/Dapr.Client/TryLockResponse.cs index 12680615b..51735f2c2 100644 --- a/src/Dapr.Client/TryLockResponse.cs +++ b/src/Dapr.Client/TryLockResponse.cs @@ -12,6 +12,7 @@ // ------------------------------------------------------------------------ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using System.Threading.Tasks; @@ -20,7 +21,7 @@ namespace Dapr.Client /// /// Class representing the response from a Lock API call. /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public sealed class TryLockResponse : IAsyncDisposable { /// diff --git a/src/Dapr.Jobs/DaprJobsClient.cs b/src/Dapr.Jobs/DaprJobsClient.cs index ff1348faf..a6e582666 100644 --- a/src/Dapr.Jobs/DaprJobsClient.cs +++ b/src/Dapr.Jobs/DaprJobsClient.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; @@ -46,7 +47,7 @@ public abstract class DaprJobsClient : IDisposable /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -58,7 +59,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// The jobName of the job. /// Cancellation token. /// The details comprising the job. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task GetJobAsync(string jobName, CancellationToken cancellationToken = default); /// @@ -66,7 +67,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// /// The jobName of the job. /// Cancellation token. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public abstract Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default); internal static KeyValuePair? GetDaprApiTokenHeader(string apiToken) diff --git a/src/Dapr.Jobs/DaprJobsGrpcClient.cs b/src/Dapr.Jobs/DaprJobsGrpcClient.cs index d58c54809..7a20542de 100644 --- a/src/Dapr.Jobs/DaprJobsGrpcClient.cs +++ b/src/Dapr.Jobs/DaprJobsGrpcClient.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using Dapr.Common; using Dapr.Jobs.Models; @@ -69,7 +70,7 @@ internal DaprJobsGrpcClient( /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -151,7 +152,7 @@ public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule sche /// The name of the job. /// Cancellation token. /// The details comprising the job. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task GetJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) @@ -199,7 +200,7 @@ public override async Task GetJobAsync(string jobName, Cancellat /// The name of the job. /// Cancellation token. /// - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public override async Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) diff --git a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs index 12d331353..85675c377 100644 --- a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs +++ b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using System.Text; using System.Text.Json; @@ -40,7 +41,7 @@ public static class DaprJobsSerializationExtensions /// Optional JSON serialization options. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, object payload, DateTime? startingFrom = null, int? repeats = null, JsonSerializerOptions? jsonSerializerOptions = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) @@ -65,7 +66,7 @@ public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental("DAPR10001")] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, string payload, DateTime? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) From 330d697f0f0b5df5fcbb127e4e44b4ae06c5a946 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 18 Mar 2025 10:21:56 -0500 Subject: [PATCH 4/8] Removed all unused usings following switch to [Experimental] Signed-off-by: Whit Waldo --- .../Client/DistributedLock/Controllers/BindingController.cs | 1 - src/Dapr.Client/DaprClient.cs | 1 - src/Dapr.Client/DaprClientGrpc.cs | 5 +---- src/Dapr.Client/TryLockResponse.cs | 1 - src/Dapr.Jobs/DaprJobsClient.cs | 1 - src/Dapr.Jobs/DaprJobsGrpcClient.cs | 1 - src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs | 1 - 7 files changed, 1 insertion(+), 10 deletions(-) diff --git a/examples/Client/DistributedLock/Controllers/BindingController.cs b/examples/Client/DistributedLock/Controllers/BindingController.cs index 0f8dc3d26..2bc9f982d 100644 --- a/examples/Client/DistributedLock/Controllers/BindingController.cs +++ b/examples/Client/DistributedLock/Controllers/BindingController.cs @@ -1,7 +1,6 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Runtime.Versioning; using System.Text.Json; using System.Threading.Tasks; using Dapr; diff --git a/src/Dapr.Client/DaprClient.cs b/src/Dapr.Client/DaprClient.cs index 88a493bcb..228d92756 100644 --- a/src/Dapr.Client/DaprClient.cs +++ b/src/Dapr.Client/DaprClient.cs @@ -19,7 +19,6 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; -using System.Runtime.Versioning; using System.Text.Json; using System.Threading; using System.Threading.Tasks; diff --git a/src/Dapr.Client/DaprClientGrpc.cs b/src/Dapr.Client/DaprClientGrpc.cs index c876a8640..3f34d1ada 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -11,20 +11,17 @@ // limitations under the License. // ------------------------------------------------------------------------ -using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; - namespace Dapr.Client; using System; using System.Buffers; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Net.Http; using System.Net.Http.Json; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Text.Json; using System.Threading; using System.Threading.Tasks; diff --git a/src/Dapr.Client/TryLockResponse.cs b/src/Dapr.Client/TryLockResponse.cs index 51735f2c2..128ae01f1 100644 --- a/src/Dapr.Client/TryLockResponse.cs +++ b/src/Dapr.Client/TryLockResponse.cs @@ -13,7 +13,6 @@ using System; using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; using System.Threading.Tasks; namespace Dapr.Client diff --git a/src/Dapr.Jobs/DaprJobsClient.cs b/src/Dapr.Jobs/DaprJobsClient.cs index a6e582666..0fc36c0ac 100644 --- a/src/Dapr.Jobs/DaprJobsClient.cs +++ b/src/Dapr.Jobs/DaprJobsClient.cs @@ -12,7 +12,6 @@ // ------------------------------------------------------------------------ using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; diff --git a/src/Dapr.Jobs/DaprJobsGrpcClient.cs b/src/Dapr.Jobs/DaprJobsGrpcClient.cs index 7a20542de..0e19b324a 100644 --- a/src/Dapr.Jobs/DaprJobsGrpcClient.cs +++ b/src/Dapr.Jobs/DaprJobsGrpcClient.cs @@ -12,7 +12,6 @@ // ------------------------------------------------------------------------ using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; using Dapr.Common; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; diff --git a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs index 85675c377..b6370aef7 100644 --- a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs +++ b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs @@ -12,7 +12,6 @@ // ------------------------------------------------------------------------ using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; using System.Text; using System.Text.Json; using Dapr.Jobs.Models; From 13c07860bf0a67167ada80a62f724611946d4385 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Thu, 27 Mar 2025 14:36:49 -0500 Subject: [PATCH 5/8] Updated solution to use [Experimental] attribute instead of [Obsolete] with constants reflecting each package. Signed-off-by: Whit Waldo --- all.sln | 35 ++++++++ .../Controllers/BindingController.cs | 5 +- src/Dapr.Client/DaprClient.cs | 41 ++++----- src/Dapr.Client/DaprClientGrpc.cs | 32 +++---- src/Dapr.Client/TryLockResponse.cs | 3 +- src/Dapr.Common/DaprExperimentalConstants.cs | 83 +++++++++++++++++++ src/Dapr.Common/IDaprServiceBuilder.cs | 27 ++++++ src/Dapr.Jobs/DaprJobsClient.cs | 7 +- src/Dapr.Jobs/DaprJobsGrpcClient.cs | 7 +- .../Extensions/DaprSerializationExtensions.cs | 5 +- 10 files changed, 199 insertions(+), 46 deletions(-) create mode 100644 src/Dapr.Common/DaprExperimentalConstants.cs create mode 100644 src/Dapr.Common/IDaprServiceBuilder.cs diff --git a/all.sln b/all.sln index 9a163b1d9..0dfaee903 100644 --- a/all.sln +++ b/all.sln @@ -155,6 +155,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JobsSample", "examples\Jobs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Test", "test\Dapr.Workflow.Test\Dapr.Workflow.Test.csproj", "{E90114C6-86FC-43B8-AE5C-D9273CF21FE4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.State", "src\Dapr.State\Dapr.State.csproj", "{181B6461-0DE9-4218-B2A4-3F579C1E1988}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.State.Test", "test\Dapr.State.Test\Dapr.State.Test.csproj", "{795BE83E-8953-4BF8-984E-3533A8BB9A64}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators\Dapr.Workflow.Generators.csproj", "{CEF36333-D0CC-454F-9E7D-E63A41004005}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators.Sample", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators.Sample\Dapr.Workflow.Generators.Sample.csproj", "{E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators.Tests", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators.Tests\Dapr.Workflow.Generators.Tests.csproj", "{512D5FD3-7BF4-4179-AE38-241DC9355DC8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -403,6 +413,26 @@ Global {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Release|Any CPU.Build.0 = Release|Any CPU + {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Debug|Any CPU.Build.0 = Debug|Any CPU + {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Release|Any CPU.ActiveCfg = Release|Any CPU + {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Release|Any CPU.Build.0 = Release|Any CPU + {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Release|Any CPU.Build.0 = Release|Any CPU + {CEF36333-D0CC-454F-9E7D-E63A41004005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CEF36333-D0CC-454F-9E7D-E63A41004005}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CEF36333-D0CC-454F-9E7D-E63A41004005}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CEF36333-D0CC-454F-9E7D-E63A41004005}.Release|Any CPU.Build.0 = Release|Any CPU + {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Release|Any CPU.Build.0 = Release|Any CPU + {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -477,6 +507,11 @@ Global {D9697361-232F-465D-A136-4561E0E88488} = {D687DDC4-66C5-4667-9E3A-FD8B78ECAA78} {9CAF360E-5AD3-4C4F-89A0-327EEB70D673} = {D9697361-232F-465D-A136-4561E0E88488} {E90114C6-86FC-43B8-AE5C-D9273CF21FE4} = {DD020B34-460F-455F-8D17-CF4A949F100B} + {181B6461-0DE9-4218-B2A4-3F579C1E1988} = {27C5D71D-0721-4221-9286-B94AB07B58CF} + {795BE83E-8953-4BF8-984E-3533A8BB9A64} = {DD020B34-460F-455F-8D17-CF4A949F100B} + {CEF36333-D0CC-454F-9E7D-E63A41004005} = {27C5D71D-0721-4221-9286-B94AB07B58CF} + {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC} = {27C5D71D-0721-4221-9286-B94AB07B58CF} + {512D5FD3-7BF4-4179-AE38-241DC9355DC8} = {27C5D71D-0721-4221-9286-B94AB07B58CF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {65220BF2-EAE1-4CB2-AA58-EBE80768CB40} diff --git a/examples/Client/DistributedLock/Controllers/BindingController.cs b/examples/Client/DistributedLock/Controllers/BindingController.cs index 2bc9f982d..7c5a4f54e 100644 --- a/examples/Client/DistributedLock/Controllers/BindingController.cs +++ b/examples/Client/DistributedLock/Controllers/BindingController.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Dapr; using Dapr.Client; +using Dapr.Common; using DistributedLock.Model; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -25,7 +26,7 @@ public BindingController(DaprClient client, ILogger logger) this.appId = Environment.GetEnvironmentVariable("APP_ID"); } - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.BindingIdentifier)] public async Task HandleBindingEvent() { logger.LogInformation($"Received binding event on {appId}, scanning for work."); @@ -47,7 +48,7 @@ public async Task HandleBindingEvent() return Ok(); } - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.BindingIdentifier)] private async Task AttemptToProcessFile(string fileName) { // Locks are Disposable and will automatically unlock at the end of a 'using' statement. diff --git a/src/Dapr.Client/DaprClient.cs b/src/Dapr.Client/DaprClient.cs index 228d92756..c55195f7c 100644 --- a/src/Dapr.Client/DaprClient.cs +++ b/src/Dapr.Client/DaprClient.cs @@ -22,6 +22,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Dapr.Common; using Google.Protobuf; using Grpc.Core; using Grpc.Core.Interceptors; @@ -1091,7 +1092,7 @@ public abstract Task UnsubscribeConfiguration( /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1105,7 +1106,7 @@ public abstract Task> EncryptAsync(string vaultResourceName /// Options informing how the encryption operation should be configured. /// A that can be used to cancel the operation. /// An array of encrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1118,7 +1119,7 @@ public abstract Task>> EncryptAsync(string /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1130,7 +1131,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An array of decrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default); @@ -1143,7 +1144,7 @@ public abstract Task> DecryptAsync(string vaultResourceName /// Options informing how the decryption operation should be configured. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1155,7 +1156,7 @@ public abstract Task>> DecryptAsync(string /// The name of the key to use from the Vault for the decryption operation. /// A that can be used to cancel the operation. /// An asynchronously enumerable array of decrypted bytes. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default); @@ -1171,7 +1172,7 @@ public abstract Task>> DecryptAsync(string ///// The format to use for the key result. ///// A that can be used to cancel the operation. ///// The name (and possibly version as name/version) of the key and its public key. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default); @@ -1186,7 +1187,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1206,7 +1207,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the nonce. ///// A that can be used to cancel the operation. ///// The array of encrypted bytes. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1229,7 +1230,7 @@ public abstract Task>> DecryptAsync(string ///// ///// Any associated data when using AEAD ciphers. ///// The array of plaintext bytes. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1245,7 +1246,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value used. ///// ///// The array of plaintext bytes. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, CancellationToken cancellationToken = default) => // await DecryptAsync(vaultResourceName, cipherTextBytes, algorithm, keyName, nonce, tag, Array.Empty(), cancellationToken); @@ -1261,7 +1262,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the wrapped plain-text key and the authentication tag, if applicable. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, byte[] nonce, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1275,7 +1276,7 @@ public abstract Task>> DecryptAsync(string ///// The none used. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key and the authentication tag, if applicable. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, string algorithm, // byte[] nonce, CancellationToken cancellationToken = default) => await WrapKeyAsync(vaultResourceName, plainTextKey, // keyName, algorithm, nonce, Array.Empty(), cancellationToken); @@ -1292,7 +1293,7 @@ public abstract Task>> DecryptAsync(string ///// Any associated data when using AEAD ciphers. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1307,7 +1308,7 @@ public abstract Task>> DecryptAsync(string ///// The bytes comprising the authentication tag. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, byte[] tag, // CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, @@ -1323,7 +1324,7 @@ public abstract Task>> DecryptAsync(string ///// The nonce value. ///// A that can be used to cancel the operation. ///// The bytes comprising the unwrapped key. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, // byte[] nonce, CancellationToken cancellationToken = default) => await UnwrapKeyAsync(vaultResourceName, // wrappedKey, algorithm, keyName, nonce, Array.Empty(), Array.Empty(), cancellationToken); @@ -1337,7 +1338,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// The bytes comprising the signature. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1351,7 +1352,7 @@ public abstract Task>> DecryptAsync(string ///// The name of the key used. ///// A that can be used to cancel the operation. ///// True if the signature verification is successful; otherwise false. - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1366,7 +1367,7 @@ public abstract Task>> DecryptAsync(string /// The time after which the lock gets expired. /// A that can be used to cancel the operation. /// A containing a - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public abstract Task Lock( string storeName, string resourceId, @@ -1383,7 +1384,7 @@ public abstract Task Lock( /// Indicates the identifier of lock owner. /// A that can be used to cancel the operation. /// A containing a - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public abstract Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/DaprClientGrpc.cs b/src/Dapr.Client/DaprClientGrpc.cs index 3f34d1ada..646ac92d3 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -11,6 +11,8 @@ // limitations under the License. // ------------------------------------------------------------------------ +using Dapr.Common; + namespace Dapr.Client; using System; @@ -1662,7 +1664,7 @@ public override async Task UnsubscribeConfigur #region Cryptography /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override async Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1682,7 +1684,7 @@ public override async Task> EncryptAsync(string vaultResour } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override async Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default) @@ -1783,7 +1785,7 @@ private async IAsyncEnumerable> RetrieveEncryptedStreamAsyn } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override async Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1814,7 +1816,7 @@ public override async Task>> DecryptAsync( } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default) => DecryptAsync(vaultResourceName, ciphertextStream, keyName, new DecryptionOptions(), @@ -1877,7 +1879,7 @@ private async IAsyncEnumerable> RetrieveDecryptedStreamAsyn } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions decryptionOptions, CancellationToken cancellationToken = default) @@ -1897,7 +1899,7 @@ public override async Task> DecryptAsync(string vaultResour } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public override async Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default) => await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, @@ -1906,7 +1908,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Subtle Crypto Implementation ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, Autogenerated.SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default) //{ @@ -1935,7 +1937,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync(string vaultResourceName, byte[] plainTextBytes, string algorithm, // string keyName, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -1971,7 +1973,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, string algorithm, string keyName, byte[] nonce, byte[] tag, // byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2007,7 +2009,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task<(byte[] WrappedKey, byte[] AuthenticationTag)> WrapKeyAsync(string vaultResourceName, byte[] plainTextKey, string keyName, // string algorithm, byte[] nonce, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2043,7 +2045,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, // string keyName, byte[] nonce, byte[] tag, byte[] associatedData, CancellationToken cancellationToken = default) //{ @@ -2080,7 +2082,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, CancellationToken cancellationToken = default) //{ // ArgumentVerifier.ThrowIfNullOrEmpty(vaultResourceName, nameof(vaultResourceName)); @@ -2113,7 +2115,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, //} ///// - //[Experimental("DAPR10001")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //public override async Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, // string algorithm, string keyName, CancellationToken cancellationToken = default) //{ @@ -2155,7 +2157,7 @@ await DecryptAsync(vaultResourceName, ciphertextBytes, keyName, #region Distributed Lock API /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public async override Task Lock( string storeName, string resourceId, @@ -2195,7 +2197,7 @@ public async override Task Lock( } /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public async override Task Unlock( string storeName, string resourceId, diff --git a/src/Dapr.Client/TryLockResponse.cs b/src/Dapr.Client/TryLockResponse.cs index 128ae01f1..5e2b577f2 100644 --- a/src/Dapr.Client/TryLockResponse.cs +++ b/src/Dapr.Client/TryLockResponse.cs @@ -14,13 +14,14 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; +using Dapr.Common; namespace Dapr.Client { /// /// Class representing the response from a Lock API call. /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public sealed class TryLockResponse : IAsyncDisposable { /// diff --git a/src/Dapr.Common/DaprExperimentalConstants.cs b/src/Dapr.Common/DaprExperimentalConstants.cs new file mode 100644 index 000000000..8f6db2d7d --- /dev/null +++ b/src/Dapr.Common/DaprExperimentalConstants.cs @@ -0,0 +1,83 @@ +// ________________________________________________________________________ +// Copyright 2025 The Dapr Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE_2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ________________________________________________________________________ + +namespace Dapr.Common; + +/// +/// Reflects constants available to use in the experimental attributes in various Dapr packages. +/// +public static class DaprExperimentalConstants +{ + private const string DaprPrefix = "DAPR"; + + private const string MessagingPrefix = $"{DaprPrefix}_MESSAGING"; + private const string WorkflowPrefix = $"{DaprPrefix}_WORKFLOW"; + private const string BindingPrefix = $"{DaprPrefix}_BINDING"; + private const string CryptoPrefix = $"{DaprPrefix}_CRYPTO"; + private const string StatePrefix = $"{DaprPrefix}_STATE"; + private const string AiPrefix = $"{DaprPrefix}_AI"; + private const string InvocationPrefix = $"{DaprPrefix}_INVOCATION"; + private const string ActorsPrefix = $"{DaprPrefix}_ACTORS"; + private const string JobsPrefix = $"{DaprPrefix}_JOBS"; + private const string LocksPrefix = $"{DaprPrefix}_LOCK"; + + /// + /// Identifier used for experimental flags in the Dapr.Messaging package. + /// + public const string MessagingIdentifier = $"{MessagingPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Workflow package. + /// + public const string WorkflowIdentifier = $"{WorkflowPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Binding package. + /// + public const string BindingIdentifier = $"{BindingPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Cryptography package. + /// + public const string CryptographyIdentifier = $"{CryptoPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.State package. + /// + public const string StateIdentifier = $"{StatePrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.AI package. + /// + public const string AiIdentifier = $"{AiPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Invocation package. + /// + public const string InvocationIdentifier = $"{InvocationPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Actors package. + /// + public const string ActorsIdentifier = $"{ActorsPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.Jobs package. + /// + public const string JobsIdentifier = $"{JobsPrefix}_0001"; + + /// + /// Identifier used for experimental flags in the Dapr.DistributedLock package. + /// + public const string LockIdentifier = $"{LocksPrefix}_0001"; +} diff --git a/src/Dapr.Common/IDaprServiceBuilder.cs b/src/Dapr.Common/IDaprServiceBuilder.cs new file mode 100644 index 000000000..f5782ab8a --- /dev/null +++ b/src/Dapr.Common/IDaprServiceBuilder.cs @@ -0,0 +1,27 @@ +// ------------------------------------------------------------------------ +// Copyright 2025 The Dapr Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ------------------------------------------------------------------------ + +using Microsoft.Extensions.DependencyInjection; + +namespace Dapr.Common; + +/// +/// Responsible for registering Dapr service functionality. +/// +public interface IDaprServiceBuilder +{ + /// + /// The registered services on the builder. + /// + public IServiceCollection Services { get; } +} diff --git a/src/Dapr.Jobs/DaprJobsClient.cs b/src/Dapr.Jobs/DaprJobsClient.cs index 0fc36c0ac..d3dd2e07c 100644 --- a/src/Dapr.Jobs/DaprJobsClient.cs +++ b/src/Dapr.Jobs/DaprJobsClient.cs @@ -12,6 +12,7 @@ // ------------------------------------------------------------------------ using System.Diagnostics.CodeAnalysis; +using Dapr.Common; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; @@ -46,7 +47,7 @@ public abstract class DaprJobsClient : IDisposable /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -58,7 +59,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// The jobName of the job. /// Cancellation token. /// The details comprising the job. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public abstract Task GetJobAsync(string jobName, CancellationToken cancellationToken = default); /// @@ -66,7 +67,7 @@ public abstract Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, /// /// The jobName of the job. /// Cancellation token. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public abstract Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default); internal static KeyValuePair? GetDaprApiTokenHeader(string apiToken) diff --git a/src/Dapr.Jobs/DaprJobsGrpcClient.cs b/src/Dapr.Jobs/DaprJobsGrpcClient.cs index 0e19b324a..a80123279 100644 --- a/src/Dapr.Jobs/DaprJobsGrpcClient.cs +++ b/src/Dapr.Jobs/DaprJobsGrpcClient.cs @@ -18,6 +18,7 @@ using Google.Protobuf; using Google.Protobuf.WellKnownTypes; using Grpc.Core; +using static Dapr.Common.DaprExperimentalConstants; using Autogenerated = Dapr.Client.Autogen.Grpc.v1; namespace Dapr.Jobs; @@ -69,7 +70,7 @@ internal DaprJobsGrpcClient( /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Experimental("DAPR10001")] + [Experimental(JobsIdentifier)] public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -151,7 +152,7 @@ public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule sche /// The name of the job. /// Cancellation token. /// The details comprising the job. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public override async Task GetJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) @@ -199,7 +200,7 @@ public override async Task GetJobAsync(string jobName, Cancellat /// The name of the job. /// Cancellation token. /// - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public override async Task DeleteJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) diff --git a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs index b6370aef7..5dfb1643e 100644 --- a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs +++ b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs @@ -14,6 +14,7 @@ using System.Diagnostics.CodeAnalysis; using System.Text; using System.Text.Json; +using Dapr.Common; using Dapr.Jobs.Models; namespace Dapr.Jobs.Extensions; @@ -40,7 +41,7 @@ public static class DaprJobsSerializationExtensions /// Optional JSON serialization options. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, object payload, DateTime? startingFrom = null, int? repeats = null, JsonSerializerOptions? jsonSerializerOptions = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) @@ -65,7 +66,7 @@ public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, /// The optional number of times the job should be triggered. /// Represents when the job should expire. If both this and DueTime are set, TTL needs to represent a later point in time. /// Cancellation token. - [Experimental("DAPR10001")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public static async Task ScheduleJobWithPayloadAsync(this DaprJobsClient client, string jobName, DaprJobSchedule schedule, string payload, DateTime? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, CancellationToken cancellationToken = default) From b84289601090f227eb9b45c0fefdcad98c03aa55 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Thu, 27 Mar 2025 14:39:38 -0500 Subject: [PATCH 6/8] Inadvertently added several projects from other branches to this one Signed-off-by: Whit Waldo --- all.sln | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/all.sln b/all.sln index 0dfaee903..9a163b1d9 100644 --- a/all.sln +++ b/all.sln @@ -155,16 +155,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JobsSample", "examples\Jobs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Test", "test\Dapr.Workflow.Test\Dapr.Workflow.Test.csproj", "{E90114C6-86FC-43B8-AE5C-D9273CF21FE4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.State", "src\Dapr.State\Dapr.State.csproj", "{181B6461-0DE9-4218-B2A4-3F579C1E1988}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.State.Test", "test\Dapr.State.Test\Dapr.State.Test.csproj", "{795BE83E-8953-4BF8-984E-3533A8BB9A64}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators\Dapr.Workflow.Generators.csproj", "{CEF36333-D0CC-454F-9E7D-E63A41004005}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators.Sample", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators.Sample\Dapr.Workflow.Generators.Sample.csproj", "{E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Workflow.Generators.Tests", "src\Dapr.Workflow.Generators\Dapr.Workflow.Generators.Tests\Dapr.Workflow.Generators.Tests.csproj", "{512D5FD3-7BF4-4179-AE38-241DC9355DC8}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -413,26 +403,6 @@ Global {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {E90114C6-86FC-43B8-AE5C-D9273CF21FE4}.Release|Any CPU.Build.0 = Release|Any CPU - {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Debug|Any CPU.Build.0 = Debug|Any CPU - {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Release|Any CPU.ActiveCfg = Release|Any CPU - {181B6461-0DE9-4218-B2A4-3F579C1E1988}.Release|Any CPU.Build.0 = Release|Any CPU - {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Debug|Any CPU.Build.0 = Debug|Any CPU - {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Release|Any CPU.ActiveCfg = Release|Any CPU - {795BE83E-8953-4BF8-984E-3533A8BB9A64}.Release|Any CPU.Build.0 = Release|Any CPU - {CEF36333-D0CC-454F-9E7D-E63A41004005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CEF36333-D0CC-454F-9E7D-E63A41004005}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CEF36333-D0CC-454F-9E7D-E63A41004005}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CEF36333-D0CC-454F-9E7D-E63A41004005}.Release|Any CPU.Build.0 = Release|Any CPU - {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC}.Release|Any CPU.Build.0 = Release|Any CPU - {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {512D5FD3-7BF4-4179-AE38-241DC9355DC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -507,11 +477,6 @@ Global {D9697361-232F-465D-A136-4561E0E88488} = {D687DDC4-66C5-4667-9E3A-FD8B78ECAA78} {9CAF360E-5AD3-4C4F-89A0-327EEB70D673} = {D9697361-232F-465D-A136-4561E0E88488} {E90114C6-86FC-43B8-AE5C-D9273CF21FE4} = {DD020B34-460F-455F-8D17-CF4A949F100B} - {181B6461-0DE9-4218-B2A4-3F579C1E1988} = {27C5D71D-0721-4221-9286-B94AB07B58CF} - {795BE83E-8953-4BF8-984E-3533A8BB9A64} = {DD020B34-460F-455F-8D17-CF4A949F100B} - {CEF36333-D0CC-454F-9E7D-E63A41004005} = {27C5D71D-0721-4221-9286-B94AB07B58CF} - {E19BA4E5-0D9C-4E3C-AFF9-70FFD098A6EC} = {27C5D71D-0721-4221-9286-B94AB07B58CF} - {512D5FD3-7BF4-4179-AE38-241DC9355DC8} = {27C5D71D-0721-4221-9286-B94AB07B58CF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {65220BF2-EAE1-4CB2-AA58-EBE80768CB40} From dd6d164f40ca7c04b0cb0b49f172ade7782191a0 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Thu, 27 Mar 2025 14:43:15 -0500 Subject: [PATCH 7/8] Updated to reflect shift to experimental Signed-off-by: Whit Waldo --- daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md index 6d5a55d32..cd75dc3bf 100644 --- a/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md +++ b/daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md @@ -232,12 +232,13 @@ await foreach (var items in subscribeConfigurationResponse.Source.WithCancellati using System; using System.Runtime.Versioning; using Dapr.Client; +using Dapr.Common; namespace LockService { class Program { - [RequiresPreviewFeatures("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] static async Task Main(string[] args) { var daprLockName = "lockstore"; From 3ab103fe92eca58af389775b34bdfdc16e2cb5ee Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Thu, 27 Mar 2025 16:23:54 -0500 Subject: [PATCH 8/8] Disabled experimental warnings via file-level pragma statements Signed-off-by: Whit Waldo --- .../EncryptDecryptFileStreamExample.cs | 1 + .../Examples/EncryptDecryptStringExample.cs | 1 + examples/Jobs/JobsSample/Program.cs | 1 + test/Dapr.Client.Test/CryptographyApiTest.cs | 1 + .../DistributedLockApiTest.cs | 4 +- test/Dapr.Client.Test/TryLockResponseTest.cs | 1 + .../Dapr.Jobs.Test/DaprJobsGrpcClientTests.cs | 1 + test/Dapr.State.Test/Dapr.State.Test.csproj | 40 +++++++++++++++++++ test/Dapr.State.Test/UnitTest1.cs | 9 +++++ 9 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 test/Dapr.State.Test/Dapr.State.Test.csproj create mode 100644 test/Dapr.State.Test/UnitTest1.cs diff --git a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs index 19df06345..ad5bb1604 100644 --- a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs +++ b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs @@ -13,6 +13,7 @@ using System.Buffers; using Dapr.Client; +#pragma warning disable DAPR_CRYPTO_0001 #pragma warning disable CS0618 // Type or member is obsolete namespace Cryptography.Examples diff --git a/examples/Client/Cryptography/Examples/EncryptDecryptStringExample.cs b/examples/Client/Cryptography/Examples/EncryptDecryptStringExample.cs index d29b24a60..1b7189254 100644 --- a/examples/Client/Cryptography/Examples/EncryptDecryptStringExample.cs +++ b/examples/Client/Cryptography/Examples/EncryptDecryptStringExample.cs @@ -13,6 +13,7 @@ using System.Text; using Dapr.Client; +#pragma warning disable DAPR_CRYPTO_0001 #pragma warning disable CS0618 // Type or member is obsolete namespace Cryptography.Examples diff --git a/examples/Jobs/JobsSample/Program.cs b/examples/Jobs/JobsSample/Program.cs index f19e375b3..75f121376 100644 --- a/examples/Jobs/JobsSample/Program.cs +++ b/examples/Jobs/JobsSample/Program.cs @@ -16,6 +16,7 @@ using Dapr.Jobs; using Dapr.Jobs.Extensions; using Dapr.Jobs.Models; +#pragma warning disable DAPR_JOBS_0001 var builder = WebApplication.CreateBuilder(args); builder.Services.AddDaprJobsClient(); diff --git a/test/Dapr.Client.Test/CryptographyApiTest.cs b/test/Dapr.Client.Test/CryptographyApiTest.cs index a7d57a096..126ab8865 100644 --- a/test/Dapr.Client.Test/CryptographyApiTest.cs +++ b/test/Dapr.Client.Test/CryptographyApiTest.cs @@ -3,6 +3,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; +#pragma warning disable DAPR_CRYPTO_0001 #pragma warning disable CS0618 // Type or member is obsolete namespace Dapr.Client.Test diff --git a/test/Dapr.Client.Test/DistributedLockApiTest.cs b/test/Dapr.Client.Test/DistributedLockApiTest.cs index 1935a5431..2c565b6de 100644 --- a/test/Dapr.Client.Test/DistributedLockApiTest.cs +++ b/test/Dapr.Client.Test/DistributedLockApiTest.cs @@ -17,9 +17,11 @@ using Shouldly; using System; +#pragma warning disable DAPR_LOCK_0001 + namespace Dapr.Client.Test { - [System.Obsolete] + [Obsolete] public class DistributedLockApiTest { [Fact] diff --git a/test/Dapr.Client.Test/TryLockResponseTest.cs b/test/Dapr.Client.Test/TryLockResponseTest.cs index f9b6f5247..1dfcf6ddf 100644 --- a/test/Dapr.Client.Test/TryLockResponseTest.cs +++ b/test/Dapr.Client.Test/TryLockResponseTest.cs @@ -16,6 +16,7 @@ using Xunit; using Shouldly; using System; +#pragma warning disable DAPR_LOCK_0001 namespace Dapr.Client.Test { diff --git a/test/Dapr.Jobs.Test/DaprJobsGrpcClientTests.cs b/test/Dapr.Jobs.Test/DaprJobsGrpcClientTests.cs index 4f6168830..72b7fe8d4 100644 --- a/test/Dapr.Jobs.Test/DaprJobsGrpcClientTests.cs +++ b/test/Dapr.Jobs.Test/DaprJobsGrpcClientTests.cs @@ -16,6 +16,7 @@ using Dapr.Jobs.Models; using Moq; using Xunit; +#pragma warning disable DAPR_JOBS_0001 namespace Dapr.Jobs.Test; diff --git a/test/Dapr.State.Test/Dapr.State.Test.csproj b/test/Dapr.State.Test/Dapr.State.Test.csproj new file mode 100644 index 000000000..cb8678c25 --- /dev/null +++ b/test/Dapr.State.Test/Dapr.State.Test.csproj @@ -0,0 +1,40 @@ + + + + enable + enable + false + true + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + diff --git a/test/Dapr.State.Test/UnitTest1.cs b/test/Dapr.State.Test/UnitTest1.cs new file mode 100644 index 000000000..2cdb6d642 --- /dev/null +++ b/test/Dapr.State.Test/UnitTest1.cs @@ -0,0 +1,9 @@ +namespace Dapr.State.Test; + +public class UnitTest1 +{ + [Fact] + public void Test1() + { + } +}