9 interfaces inheriting from IResource
Aspire.Hosting (7)
Aspire.Hosting.Azure (2)
2 implementations of IResource
Aspire.Hosting (1)
Aspire.Hosting.Tests (1)
341 references to IResource
Aspire.Hosting (199)
ApplicationModel\ResourceExtensions.cs (26)
11/// Provides extension methods for the <see cref="IResource"/> interface.
22public static bool TryGetLastAnnotation<T>(this IResource resource, [NotNullWhen(true)] out T? annotation) where T : IResourceAnnotation
43public static bool TryGetAnnotationsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation
65public static bool HasAnnotationOfType<T>(this IResource resource) where T : IResourceAnnotation
77public static bool TryGetAnnotationsIncludingAncestorsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation
114public static bool HasAnnotationIncludingAncestorsOfType<T>(this IResource resource) where T : IResourceAnnotation
147public static bool TryGetEnvironmentVariables(this IResource resource, [NotNullWhen(true)] out IEnumerable<EnvironmentCallbackAnnotation>? environmentVariables)
261this IResource resource,
291(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key: null, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
293(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
312this IResource resource,
340(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
342(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
361this IResource resource,
412if (valueProvider is IResource resource)
449public static bool TryGetContainerMounts(this IResource resource, [NotNullWhen(true)] out IEnumerable<ContainerMountAnnotation>? volumeMounts)
460public static bool TryGetEndpoints(this IResource resource, [NotNullWhen(true)] out IEnumerable<EndpointAnnotation>? endpoints)
469/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns>
498public static bool TryGetContainerImageName(this IResource resource, [NotNullWhen(true)] out string? imageName)
528public static int GetReplicaCount(this IResource resource)
549internal static ContainerLifetime GetContainerLifetimeType(this IResource resource)
565internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy)
583internal static bool SupportsProxy(this IResource resource)
593internal static IResource GetRootResource(this IResource resource) =>
605internal static string[] GetResolvedResourceNames(this IResource resource)
ApplicationModel\ResourceNotificationService.cs (14)
23private readonly ConcurrentDictionary<(IResource, string), ResourceNotificationState> _resourceNotificationStates = new();
142private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken)
303private async Task WaitUntilCompletionAsync(IResource resource, IResource dependency, int exitCode, CancellationToken cancellationToken)
365public async Task WaitForDependenciesAsync(IResource resource, CancellationToken cancellationToken)
455var versionsSeen = new Dictionary<(IResource, string), long>();
502public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
606private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState)
682public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
691private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState)
714private ResourceNotificationState GetResourceNotificationState(IResource resource, string resourceId) =>
740public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot)
745public IResource Resource { get; } = resource;
Dcp\DcpExecutor.cs (11)
403private static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource
874private void EnsureRequiredAnnotations(IResource resource)
882private static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder)
898async Task CreateResourceExecutablesAsyncCore(IResource resource, IEnumerable<AppResource> executables, CancellationToken cancellationToken)
1120private static DcpInstance GetDcpInstance(IResource resource, int instanceIndex)
1242private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, CancellationToken cancellationToken)
1320private void AddServicesProducedInfo(IResource modelResource, IAnnotationHolder dcpResource, AppResource appResource)
1552private async Task<(List<(string Value, bool IsSensitive)>, bool)> BuildArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1580private async Task<(List<EnvVar>, bool)> BuildEnvVarsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1607private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1667private static List<VolumeMount> BuildContainerMounts(IResource container)
Dcp\DcpExecutorEvents.cs (3)
11internal record OnResourceStartingContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName);
13internal record OnResourceChangedContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string DcpResourceName, ResourceStatus Status, Func<CustomResourceSnapshot, CustomResourceSnapshot> UpdateSnapshot);
14internal record OnResourceFailedToStartContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName);
Orchestrator\ApplicationOrchestrator.cs (10)
20private readonly ILookup<IResource, IResource> _parentChildLookup;
140static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
155async Task ProcessValueAsync(IResource resource, IValueProvider vp)
279private async Task SetChildResourceAsync(IResource resource, string parentName, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp)
281foreach (var child in _parentChildLookup[resource])
298private async Task SetExecutableChildResourceAsync(IResource resource)
304foreach (var child in _parentChildLookup[resource])
330private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource)
341private async Task PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken)
Orchestrator\RelationshipEvaluator.cs (19)
13public static ILookup<IResource, IResource> GetParentChildLookup(DistributedApplicationModel model)
18.Select(x => (Child: (IResource)x, Parent: x.Parent))
24private static IEnumerable<(IResource Child, IResource Parent)> GetParentChildRelationshipsFromAnnotations(DistributedApplicationModel model)
26static bool TryGetParent(IResource resource, [NotNullWhen(true)] out IResource? parent)
39static IResource? SelectParentResource(IResource? resource) => resource switch
41IResource r when TryGetParent(r, out var parent) => parent,
54private static void ValidateRelationships((IResource Child, IResource Parent)[] relationships)
64var visited = new Stack<IResource>();
70static void ValidateNoCircularDependencies(Dictionary<IResource, IResource> childToParentLookup, IResource child, Stack<IResource> visited)
73if (childToParentLookup.TryGetValue(child, out var parent))
ResourceBuilderExtensions.cs (23)
263public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource
279public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
694public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource
712/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results
728public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport
748/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results
756/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para>
770public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport
778private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
780if (builder.Resource as IResource == dependency.Resource)
805foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>())
840public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource
871public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport
876if (builder.Resource as IResource == dependency.Resource)
901/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource
927public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource
1125bool isHighlighted = false) where T : IResource
1167IResource resource,
1168string type) where T : IResource
1202IResourceBuilder<IResource> parent) where T : IResource
1232IResource parent) where T : IResource
Aspire.Hosting.Azure (11)
Provisioning\Provisioners\AzureProvisioner.cs (8)
46private static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel)
53var azureResources = new List<(IResource, IAzureResource)>();
54foreach (var resource in appModel.Resources)
76private ILookup<IResource, IResourceWithParent>? _parentChildLookup;
106async Task UpdateStateAsync((IResource Resource, IAzureResource AzureResource) resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
132async Task AfterProvisionAsync((IResource Resource, IAzureResource AzureResource) resource)
203IList<(IResource Resource, IAzureResource AzureResource)> azureResources,
260private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, (IResource Resource, IAzureResource AzureResource) resource, CancellationToken cancellationToken)
Aspire.Hosting.Azure.AppContainers (12)
AzureContainerAppsInfrastructure.cs (12)
43foreach (var r in appModel.Resources)
79private readonly Dictionary<IResource, ContainerAppContext> _containerApps = [];
81public async Task<AzureBicepResource> CreateContainerAppAsync(IResource resource, AzureProvisioningOptions provisioningOptions, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
91private async Task<ContainerAppContext> ProcessResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
102private sealed class ContainerAppContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
119public IResource Resource => resource;
230private static bool TryGetContainerImageName(IResource resource, out string? containerImageName)
974private sealed class ResourceExpression(IResource resource, string propertyExpression) : IManifestExpressionProvider
978public static IManifestExpressionProvider GetContainerImageExpression(IResource p) =>
981public static IManifestExpressionProvider GetContainerPortExpression(IResource p) =>
988private sealed class VolumeStorageExpression(IResource resource, ContainerMountType type, string index) : IManifestExpressionProvider
997public static IManifestExpressionProvider GetVolumeStorage(IResource resource, ContainerMountType type, string index) =>
Aspire.Hosting.Azure.CosmosDB (1)
Aspire.Hosting.Azure.EventHubs (1)
Aspire.Hosting.Azure.ServiceBus (1)
Aspire.Hosting.Azure.SignalR (1)
Aspire.Hosting.Azure.Storage (1)
Aspire.Hosting.Azure.Tests (29)
Aspire.Hosting.Containers.Tests (10)
Aspire.Hosting.Kafka.Tests (1)
Aspire.Hosting.Milvus.Tests (2)
Aspire.Hosting.MySql.Tests (4)
Aspire.Hosting.Oracle.Tests (3)
Aspire.Hosting.PostgreSQL (3)
Aspire.Hosting.PostgreSQL.Tests (7)
Aspire.Hosting.Qdrant.Tests (3)
Aspire.Hosting.Redis (2)
Aspire.Hosting.Redis.Tests (3)
Aspire.Hosting.Testing (10)
Aspire.Hosting.Testing.Tests (3)
Aspire.Hosting.Tests (26)
Aspire.Playground.Tests (3)
Stress.AppHost (5)