Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static IApplicationBuilder UseAzureAppConfiguration(this IApplicationBuil
throw new ArgumentNullException(nameof(builder));
}

IConfigurationRefresherProvider refresherProvider = (IConfigurationRefresherProvider)builder.ApplicationServices.GetService(typeof(IConfigurationRefresherProvider));
IConfigurationRefresherProvider? refresherProvider = (IConfigurationRefresherProvider?)builder.ApplicationServices.GetService(typeof(IConfigurationRefresherProvider));

// Verify if AddAzureAppConfiguration was done before calling UseAzureAppConfiguration.
// We use the IConfigurationRefresherProvider to make sure if the required services were added.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<Description>Microsoft.Azure.AppConfiguration.AspNetCore allows developers to use Microsoft Azure App Configuration service as a configuration source in their applications. This package adds additional features for ASP.NET Core applications to the existing package Microsoft.Extensions.Configuration.AzureAppConfiguration.</Description>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class AzureAppConfigurationRefreshExtensions
public static IFunctionsWorkerApplicationBuilder UseAzureAppConfiguration(this IFunctionsWorkerApplicationBuilder builder)
{
IServiceProvider serviceProvider = builder.Services.BuildServiceProvider();
IConfigurationRefresherProvider refresherProvider = serviceProvider.GetService<IConfigurationRefresherProvider>();
IConfigurationRefresherProvider? refresherProvider = serviceProvider.GetService<IConfigurationRefresherProvider>();

// Verify if AddAzureAppConfiguration was done before calling UseAzureAppConfiguration.
// We use the IConfigurationRefresherProvider to make sure if the required services were added.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<Description>Microsoft.Azure.AppConfiguration.Functions.Worker allows developers to use the Microsoft Azure App Configuration service as a configuration source in their applications. This package adds additional features to the existing package Microsoft.Extensions.Configuration.AzureAppConfiguration for .NET Azure Functions running in an isolated process.</Description>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public class AzureAppConfigurationKeyVaultOptions
// This allows the provider to throw a KeyVaultReferenceException with all relevant information and halt startup instead of timing out.
private const int KeyVaultMaxRetries = 6;

internal TokenCredential Credential;
internal TokenCredential? Credential;
internal SecretClientOptions ClientOptions = new SecretClientOptions
{
Retry = {
MaxRetries = KeyVaultMaxRetries
}
};
internal List<SecretClient> SecretClients = new List<SecretClient>();
internal Func<Uri, ValueTask<string>> SecretResolver;
internal Func<Uri, ValueTask<string>>? SecretResolver;
internal Dictionary<string, TimeSpan> SecretRefreshIntervals = new Dictionary<string, TimeSpan>();
internal TimeSpan? DefaultSecretRefreshInterval = null;
internal bool IsKeyVaultRefreshConfigured = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ public class AzureAppConfigurationOptions
/// <summary>
/// The list of connection strings used to connect to an Azure App Configuration store and its replicas.
/// </summary>
internal IEnumerable<string> ConnectionStrings { get; private set; }
internal IEnumerable<string>? ConnectionStrings { get; private set; }

/// <summary>
/// The list of endpoints of an Azure App Configuration store.
/// If this property is set, the <see cref="Credential"/> property also needs to be set.
/// </summary>
internal IEnumerable<Uri> Endpoints { get; private set; }
internal IEnumerable<Uri>? Endpoints { get; private set; }

/// <summary>
/// The credential used to connect to the Azure App Configuration.
/// If this property is set, the <see cref="Endpoints"/> property also needs to be set.
/// </summary>
internal TokenCredential Credential { get; private set; }
internal TokenCredential? Credential { get; private set; }

/// <summary>
/// A collection of <see cref="KeyValueSelector"/> specified by user.
Expand Down Expand Up @@ -96,7 +96,7 @@ public class AzureAppConfigurationOptions
internal IEnumerable<IKeyValueAdapter> Adapters
{
get => _adapters;
set => _adapters = value?.ToList();
set => _adapters = value?.ToList() ?? new List<IKeyValueAdapter>();
}

/// <summary>
Expand All @@ -112,17 +112,17 @@ internal IEnumerable<IKeyValueAdapter> Adapters
/// <summary>
/// For use in tests only. An optional configuration client manager that can be used to provide clients to communicate with Azure App Configuration.
/// </summary>
internal IConfigurationClientManager ClientManager { get; set; }
internal IConfigurationClientManager? ClientManager { get; set; }

/// <summary>
/// For use in tests only. An optional class used to process pageable results from Azure App Configuration.
/// </summary>
internal IConfigurationSettingPageIterator ConfigurationSettingPageIterator { get; set; }
internal IConfigurationSettingPageIterator? ConfigurationSettingPageIterator { get; set; }

/// <summary>
/// For use in tests only. An optional activity source name to specify the activity source used by the configuration provider.
/// </summary>
internal string ActivitySourceName { get; set; }
internal string? ActivitySourceName { get; set; }

/// <summary>
/// An optional timespan value to set the minimum backoff duration to a value other than the default.
Expand Down Expand Up @@ -157,7 +157,7 @@ internal IEnumerable<IKeyValueAdapter> Adapters
/// <summary>
/// Client factory that is responsible for creating instances of ConfigurationClient.
/// </summary>
internal IAzureClientFactory<ConfigurationClient> ClientFactory { get; private set; }
internal IAzureClientFactory<ConfigurationClient>? ClientFactory { get; private set; }

/// <summary>
/// Initializes a new instance of the <see cref="AzureAppConfigurationOptions"/> class.
Expand Down Expand Up @@ -215,7 +215,7 @@ public AzureAppConfigurationOptions SetClientFactory(IAzureClientFactory<Configu
/// The characters asterisk (*), comma (,) and backslash (\) are reserved and must be escaped using a backslash (\).
/// Up to 5 tag filters can be provided. If no tag filters are provided, key-values will not be filtered based on tags.
/// </param>
public AzureAppConfigurationOptions Select(string keyFilter, string labelFilter = LabelFilter.Null, IEnumerable<string> tagFilters = null)
public AzureAppConfigurationOptions Select(string keyFilter, string labelFilter = LabelFilter.Null, IEnumerable<string>? tagFilters = null)
{
if (string.IsNullOrEmpty(keyFilter))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
#nullable disable
using Azure;
using Azure.Data.AppConfiguration;
using Microsoft.Extensions.Configuration.AzureAppConfiguration.SnapshotReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public AzureAppConfigurationSource(Action<AzureAppConfigurationOptions> optionsI

public IConfigurationProvider Build(IConfigurationBuilder builder)
{
IConfigurationProvider provider = null;
IConfigurationProvider? provider = null;

try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
#nullable disable
using Azure;
using Azure.Data.AppConfiguration;
using Azure.Security.KeyVault.Secrets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
#nullable disable
using Azure.Security.KeyVault.Secrets;
using Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class CachedKeyVaultSecret
///// <summary>
///// The value of the Key Vault secret.
///// </summary>
public string SecretValue { get; set; }
public string? SecretValue { get; set; }

/// <summary>
/// The time when this secret should be reloaded from Key Vault.
Expand All @@ -30,9 +30,9 @@ internal class CachedKeyVaultSecret
/// <summary>
/// The source <see cref="Uri"/> for this secret.
/// </summary>
public Uri SourceId { get; }
public Uri? SourceId { get; }

public CachedKeyVaultSecret(string secretValue = null, Uri sourceId = null, DateTimeOffset? refreshAt = null, int refreshAttempts = 0)
public CachedKeyVaultSecret(string? secretValue = null, Uri? sourceId = null, DateTimeOffset? refreshAt = null, int refreshAttempts = 0)
{
SecretValue = secretValue;
RefreshAt = refreshAt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
#nullable disable

using Azure.Data.AppConfiguration;
using DnsClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration
{
internal class EndpointComparer : IEqualityComparer<Uri>
{
public bool Equals(Uri endpoint1, Uri endpoint2)
public bool Equals(Uri? endpoint1, Uri? endpoint2)
{
return Uri.Compare(endpoint1,
endpoint2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ public KeyVaultReferenceException(string message,
/// <summary>
/// The key of the Key Vault reference that caused the exception.
/// </summary>
public string Key { get; set; }
public string? Key { get; set; }

/// <summary>
/// The label of the Key Vault reference that caused the exception.
/// </summary>
public string Label { get; set; }
public string? Label { get; set; }

/// <summary>
/// The etag of the Key Vault reference that caused the exception.
/// </summary>
public string Etag { get; set; }
public string? Etag { get; set; }

/// <summary>
/// The secret identifier used by the Azure Key Vault reference that caused the exception.
/// </summary>
public string SecretIdentifier { get; set; }
public string? SecretIdentifier { get; set; }

/// <summary>
/// The error code, if available, describing the cause of the exception.
/// </summary>
public string ErrorCode { get; set; }
public string? ErrorCode { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class EventGridEventExtensions
/// <param name="eventGridEvent"> EventGridEvent from EventGrid</param>
/// <param name="pushNotification"> If this method returns true, the pushNotification object contains details populated from eventGridEvent. If this method returns false, the pushNotification object is null. </param>
/// <returns></returns>
public static bool TryCreatePushNotification(this EventGridEvent eventGridEvent, out PushNotification pushNotification)
public static bool TryCreatePushNotification(this EventGridEvent eventGridEvent, out PushNotification? pushNotification)
{
pushNotification = null;

Expand All @@ -29,9 +29,9 @@ public static bool TryCreatePushNotification(this EventGridEvent eventGridEvent,
return false;
}

if (Uri.TryCreate(eventGridEvent.Subject, UriKind.Absolute, out Uri resourceUri))
if (Uri.TryCreate(eventGridEvent.Subject, UriKind.Absolute, out Uri? resourceUri))
{
string syncToken = null;
string? syncToken = null;

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions
{
internal static class StringExtensions
{
public static bool TryParseContentType(this string contentTypeString, out ContentType contentType)
public static bool TryParseContentType(this string contentTypeString, out ContentType? contentType)
{
contentType = null;

Expand All @@ -35,7 +35,7 @@ public static bool TryParseContentType(this string contentTypeString, out Conten
}
}

public static string NormalizeNull(this string s)
public static string? NormalizeNull(this string? s)
{
return s == LabelFilter.Null ? null : s;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class ClientFilter
{
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

public JsonElement Parameters { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class FeatureAllocation
{
public string DefaultWhenDisabled { get; set; }
public string? DefaultWhenDisabled { get; set; }

public string DefaultWhenEnabled { get; set; }
public string? DefaultWhenEnabled { get; set; }

public IEnumerable<FeatureUserAllocation> User { get; set; }
public IEnumerable<FeatureUserAllocation>? User { get; set; }

public IEnumerable<FeatureGroupAllocation> Group { get; set; }
public IEnumerable<FeatureGroupAllocation>? Group { get; set; }

public IEnumerable<FeaturePercentileAllocation> Percentile { get; set; }
public IEnumerable<FeaturePercentileAllocation>? Percentile { get; set; }

public string Seed { get; set; }
public string? Seed { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ internal class FeatureConditions
{
public List<ClientFilter> ClientFilters { get; set; } = new List<ClientFilter>();

public string RequirementType { get; set; }
public string? RequirementType { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class FeatureFlag
{
public string Id { get; set; }
public string Id { get; set; } = string.Empty;

public bool Enabled { get; set; }

public FeatureConditions Conditions { get; set; }
public FeatureConditions? Conditions { get; set; }

public IEnumerable<FeatureVariant> Variants { get; set; }
public IEnumerable<FeatureVariant>? Variants { get; set; }

public FeatureAllocation Allocation { get; set; }
public FeatureAllocation? Allocation { get; set; }

public FeatureTelemetry Telemetry { get; set; }
public FeatureTelemetry? Telemetry { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal TimeSpan RefreshInterval
/// <summary>
/// The label that feature flags will be selected from.
/// </summary>
public string Label { get; set; }
public string? Label { get; set; }

/// <summary>
/// The time after which the cached values of the feature flags expire. Must be greater than or equal to 1 second.
Expand Down Expand Up @@ -81,7 +81,7 @@ public FeatureFlagOptions SetRefreshInterval(TimeSpan refreshInterval)
/// The characters asterisk (*), comma (,) and backslash (\) are reserved and must be escaped using a backslash (\).
/// Up to 5 tag filters can be provided. If no tag filters are provided, feature flags will not be filtered based on tags.
/// </param>
public FeatureFlagOptions Select(string featureFlagFilter, string labelFilter = LabelFilter.Null, IEnumerable<string> tagFilters = null)
public FeatureFlagOptions Select(string featureFlagFilter, string labelFilter = LabelFilter.Null, IEnumerable<string>? tagFilters = null)
{
if (string.IsNullOrEmpty(featureFlagFilter))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class FeatureGroupAllocation
{
public string Variant { get; set; }
public string? Variant { get; set; }

public IEnumerable<string> Groups { get; set; }
public IEnumerable<string>? Groups { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
#nullable disable
using Azure.Data.AppConfiguration;
using Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class FeaturePercentileAllocation
{
public string Variant { get; set; }
public string? Variant { get; set; }

public double From { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ internal class FeatureTelemetry
{
public bool Enabled { get; set; }

public IDictionary<string, string> Metadata { get; set; }
public IDictionary<string, string>? Metadata { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.FeatureManage
{
internal class FeatureUserAllocation
{
public string Variant { get; set; }
public string? Variant { get; set; }

public IEnumerable<string> Users { get; set; }
public IEnumerable<string>? Users { get; set; }
}
}
Loading
Loading