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..cd75dc3bf 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,15 @@ await foreach (var items in subscribeConfigurationResponse.Source.WithCancellati ```csharp using System; +using System.Runtime.Versioning; using Dapr.Client; +using Dapr.Common; namespace LockService { class Program { - [Obsolete("Distributed Lock API is in Alpha, this can be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] static async Task Main(string[] args) { var daprLockName = "lockstore"; 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/Client/DistributedLock/Controllers/BindingController.cs b/examples/Client/DistributedLock/Controllers/BindingController.cs index aa4dd1f52..7c5a4f54e 100644 --- a/examples/Client/DistributedLock/Controllers/BindingController.cs +++ b/examples/Client/DistributedLock/Controllers/BindingController.cs @@ -1,9 +1,11 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Dapr; using Dapr.Client; +using Dapr.Common; using DistributedLock.Model; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -24,8 +26,7 @@ public BindingController(DaprClient client, ILogger logger) this.appId = Environment.GetEnvironmentVariable("APP_ID"); } - [HttpPost("cronbinding")] - [Obsolete] + [Experimental(DaprExperimentalConstants.BindingIdentifier)] public async Task HandleBindingEvent() { logger.LogInformation($"Received binding event on {appId}, scanning for work."); @@ -47,8 +48,7 @@ public async Task HandleBindingEvent() return Ok(); } - - [Obsolete] + [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/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/src/Dapr.Client/DaprClient.cs b/src/Dapr.Client/DaprClient.cs index 6be31a648..c55195f7c 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; @@ -21,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; @@ -1090,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> EncryptAsync(string vaultResourceName, ReadOnlyMemory plaintextBytes, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1104,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> EncryptAsync(string vaultResourceName, Stream plaintextStream, string keyName, EncryptionOptions encryptionOptions, CancellationToken cancellationToken = default); @@ -1117,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1129,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task> DecryptAsync(string vaultResourceName, ReadOnlyMemory ciphertextBytes, string keyName, CancellationToken cancellationToken = default); @@ -1142,8 +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. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, DecryptionOptions options, CancellationToken cancellationToken = default); @@ -1155,8 +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. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] public abstract Task>> DecryptAsync(string vaultResourceName, Stream ciphertextStream, string keyName, CancellationToken cancellationToken = default); @@ -1172,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task<(string Name, string PublicKey)> GetKeyAsync(string vaultResourceName, string keyName, SubtleGetKeyRequest.Types.KeyFormat keyFormat, // CancellationToken cancellationToken = default); @@ -1187,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1207,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public async Task<(byte[] CipherTextBytes, byte[] AuthenticationTag)> EncryptAsync( // string vaultResourceName, // byte[] plainTextBytes, @@ -1230,7 +1230,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.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task DecryptAsync(string vaultResourceName, byte[] cipherTextBytes, // string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1246,8 +1246,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.")] + //[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); @@ -1263,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[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); @@ -1277,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[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); @@ -1294,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task UnwrapKeyAsync(string vaultResourceName, byte[] wrappedKey, string algorithm, string keyName, byte[] nonce, byte[] tag, byte[] associatedData, // CancellationToken cancellationToken = default); @@ -1309,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[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, @@ -1325,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[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); @@ -1339,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task SignAsync(string vaultResourceName, byte[] digest, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1353,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. - //[Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + //[Experimental(DaprExperimentalConstants.DaprExperimentalCryptoIdentifier)] //public abstract Task VerifyAsync(string vaultResourceName, byte[] digest, byte[] signature, string algorithm, string keyName, // CancellationToken cancellationToken = default); @@ -1368,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 - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public abstract Task Lock( string storeName, string resourceId, @@ -1385,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 - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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 394b313e2..646ac92d3 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -11,19 +11,19 @@ // limitations under the License. // ------------------------------------------------------------------------ -using Dapr.Common.Extensions; +using Dapr.Common; 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; @@ -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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + [Experimental(DaprExperimentalConstants.CryptographyIdentifier)] 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.")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //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.")] + //[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) //{ @@ -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.")] + //[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) //{ @@ -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.")] + //[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) //{ @@ -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.")] + //[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) //{ @@ -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.")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //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.")] + //[Experimental(DaprExperimentalConstants.CryptographyIdentifier)] //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] + [Experimental(DaprExperimentalConstants.LockIdentifier)] public async override Task Lock( string storeName, string resourceId, @@ -2203,7 +2197,7 @@ public async override Task Lock( } /// - [Obsolete] + [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 e9057fbb4..5e2b577f2 100644 --- a/src/Dapr.Client/TryLockResponse.cs +++ b/src/Dapr.Client/TryLockResponse.cs @@ -12,14 +12,16 @@ // ------------------------------------------------------------------------ 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. /// - [Obsolete("This API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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 4dd4abd70..d3dd2e07c 100644 --- a/src/Dapr.Jobs/DaprJobsClient.cs +++ b/src/Dapr.Jobs/DaprJobsClient.cs @@ -11,6 +11,8 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; +using Dapr.Common; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; @@ -45,8 +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. - [Obsolete( - "The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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 8743aa350..a80123279 100644 --- a/src/Dapr.Jobs/DaprJobsGrpcClient.cs +++ b/src/Dapr.Jobs/DaprJobsGrpcClient.cs @@ -11,12 +11,14 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using Dapr.Common; using Dapr.Jobs.Models; using Dapr.Jobs.Models.Responses; 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; @@ -68,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [Experimental(JobsIdentifier)] public override async Task ScheduleJobAsync(string jobName, DaprJobSchedule schedule, ReadOnlyMemory? payload = null, DateTimeOffset? startingFrom = null, int? repeats = null, DateTimeOffset? ttl = null, @@ -150,7 +152,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.")] + [Experimental(DaprExperimentalConstants.JobsIdentifier)] public override async Task GetJobAsync(string jobName, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(jobName)) @@ -198,7 +200,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.")] + [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 1f02a32cd..5dfb1643e 100644 --- a/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs +++ b/src/Dapr.Jobs/Extensions/DaprSerializationExtensions.cs @@ -11,8 +11,10 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System.Diagnostics.CodeAnalysis; using System.Text; using System.Text.Json; +using Dapr.Common; using Dapr.Jobs.Models; namespace Dapr.Jobs.Extensions; @@ -39,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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) @@ -64,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. - [Obsolete("The API is currently not stable as it is in the Alpha stage. This attribute will be removed once it is stable.")] + [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) 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() + { + } +}