12 interfaces inheriting from IResource
Aspire.Hosting (9)
Aspire.Hosting.Azure (3)
2 implementations of IResource
Aspire.Hosting (1)
Aspire.Hosting.Tests (1)
446 references to IResource
Aspire.Hosting (229)
ApplicationModel\ResourceExtensions.cs (28)
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)
274this IResource resource,
304(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key: null, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
306(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
335this IResource resource,
363(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
365(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
384this IResource resource,
435if (valueProvider is IResource resource)
472public static bool TryGetContainerMounts(this IResource resource, [NotNullWhen(true)] out IEnumerable<ContainerMountAnnotation>? volumeMounts)
483public static bool TryGetEndpoints(this IResource resource, [NotNullWhen(true)] out IEnumerable<EndpointAnnotation>? endpoints)
494public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls)
503/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns>
532public static bool TryGetContainerImageName(this IResource resource, [NotNullWhen(true)] out string? imageName)
562public static int GetReplicaCount(this IResource resource)
578public static DeploymentTargetAnnotation? GetDeploymentTargetAnnotation(this IResource resource)
619internal static ContainerLifetime GetContainerLifetimeType(this IResource resource)
635internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy)
653internal static bool SupportsProxy(this IResource resource)
663internal static IResource GetRootResource(this IResource resource) =>
675internal 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)
610private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState)
686public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
695private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState)
718private ResourceNotificationState GetResourceNotificationState(IResource resource, string resourceId) =>
744public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot)
749public IResource Resource { get; } = resource;
Dcp\DcpExecutor.cs (12)
406private static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource
912private void EnsureRequiredAnnotations(IResource resource)
920private static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder)
936async Task CreateResourceExecutablesAsyncCore(IResource resource, IEnumerable<AppResource> executables, CancellationToken cancellationToken)
1158private static DcpInstance GetDcpInstance(IResource resource, int instanceIndex)
1282private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, CancellationToken cancellationToken)
1360private void AddServicesProducedInfo(IResource modelResource, IAnnotationHolder dcpResource, AppResource appResource)
1633private async Task<(List<(string Value, bool IsSensitive)>, bool)> BuildArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1661private async Task<List<ContainerCreateFileSystem>> BuildCreateFilesAsync(IResource modelResource, CancellationToken cancellationToken)
1691private async Task<(List<EnvVar>, bool)> BuildEnvVarsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1718private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1778private 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 (11)
20private readonly ILookup<IResource, IResource> _parentChildLookup;
143static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
156private async Task ProcessUrls(IResource resource, CancellationToken cancellationToken)
224async Task ProcessValueAsync(IResource resource, IValueProvider vp)
348private async Task SetChildResourceAsync(IResource resource, string parentName, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp)
350foreach (var child in _parentChildLookup[resource])
367private async Task SetExecutableChildResourceAsync(IResource resource)
373foreach (var child in _parentChildLookup[resource])
399private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource)
410private 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 (39)
277public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource
293public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
750where T : IResource
773where T : IResource
794where T : IResource
815where T : IResource
837where T : IResource
892where T : IResource
963public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource
981/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results
997public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport
1017/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results
1025/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para>
1039public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport
1047private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
1049if (builder.Resource as IResource == dependency.Resource)
1074foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>())
1109public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource
1140public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport
1145if (builder.Resource as IResource == dependency.Resource)
1170/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource
1196public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource
1370CommandOptions? commandOptions = null) where T : IResource
1437bool isHighlighted = false) where T : IResource
1775IResource resource,
1776string type) where T : IResource
1794IResource resource) where T : IResource
1811ReferenceExpression expression) where T : IResource
1822where T : IResource
1826void AddReference(IResource resource)
1838if (value is IResource resource)
1842else if (value is IResourceBuilder<IResource> resourceBuilder)
1870IResourceBuilder<IResource> resourceBuilder) where T : IResource
1903IResourceBuilder<IResource> parent) where T : IResource
1933IResource parent) where T : IResource
Aspire.Hosting.Azure (20)
AzureResourcePreparer.cs (10)
52internal static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel)
59var azureResources = new List<(IResource, IAzureResource)>();
60foreach (var resource in appModel.Resources)
91foreach (var resource in appModel.Resources)
100private async Task BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List<(IResource Resource, IAzureResource AzureResource)> azureResources, AzureProvisioningOptions options, CancellationToken cancellationToken)
126foreach (var resource in resourceSnapshot)
214private static Dictionary<AzureProvisioningResource, IEnumerable<RoleDefinition>> GetAllRoleAssignments(IResource resource)
229IResource resource,
243IResource resource,
307private async Task<HashSet<IAzureResource>> GetAzureReferences(IResource resource, CancellationToken cancellationToken)
Provisioning\Provisioners\AzureProvisioner.cs (6)
45private ILookup<IResource, IResourceWithParent>? _parentChildLookup;
65async Task UpdateStateAsync((IResource Resource, IAzureResource AzureResource) resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
104async Task AfterProvisionAsync((IResource Resource, IAzureResource AzureResource) resource)
138async Task<bool> WaitForRoleAssignments((IResource Resource, IAzureResource AzureResource) resource)
205IList<(IResource Resource, IAzureResource AzureResource)> azureResources,
262private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, (IResource Resource, IAzureResource AzureResource) resource, CancellationToken cancellationToken)
Aspire.Hosting.Azure.AppConfiguration (3)
Aspire.Hosting.Azure.AppContainers (16)
Aspire.Hosting.Azure.CognitiveServices (3)
Aspire.Hosting.Azure.CosmosDB (1)
Aspire.Hosting.Azure.EventHubs (4)
Aspire.Hosting.Azure.Functions (2)
Aspire.Hosting.Azure.KeyVault (3)
Aspire.Hosting.Azure.Search (3)
Aspire.Hosting.Azure.ServiceBus (4)
Aspire.Hosting.Azure.SignalR (4)
Aspire.Hosting.Azure.Storage (4)
Aspire.Hosting.Azure.Tests (36)
Aspire.Hosting.Azure.WebPubSub (3)
Aspire.Hosting.Containers.Tests (10)
Aspire.Hosting.Docker (7)
Aspire.Hosting.Docker.Tests (1)
Aspire.Hosting.Kafka.Tests (1)
Aspire.Hosting.Kubernetes (19)
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 (25)
Aspire.Playground.Tests (3)
Stress.AppHost (5)