13 interfaces inheriting from IResource
Aspire.Hosting (10)
Aspire.Hosting.Azure (3)
2 implementations of IResource
Aspire.Hosting (1)
Aspire.Hosting.Tests (1)
472 references to IResource
Aspire.Hosting (236)
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)
579public static DeploymentTargetAnnotation? GetDeploymentTargetAnnotation(this IResource resource, IComputeEnvironmentResource? targetComputeEnvironment = null)
625internal static ContainerLifetime GetContainerLifetimeType(this IResource resource)
641internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy)
659internal static bool SupportsProxy(this IResource resource)
669internal static IResource GetRootResource(this IResource resource) =>
681internal 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)
453var versionsSeen = new Dictionary<(IResource, string), long>();
500public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
586private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState)
662public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
671private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState)
694private ResourceNotificationState GetResourceNotificationState(IResource resource, string resourceId) =>
720public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot)
725public IResource Resource { get; } = resource;
Dcp\DcpExecutor.cs (12)
411private static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource
917private void EnsureRequiredAnnotations(IResource resource)
925private static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder)
941async Task CreateResourceExecutablesAsyncCore(IResource resource, IEnumerable<AppResource> executables, CancellationToken cancellationToken)
1163private static DcpInstance GetDcpInstance(IResource resource, int instanceIndex)
1287private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, CancellationToken cancellationToken)
1365private void AddServicesProducedInfo(IResource modelResource, IAnnotationHolder dcpResource, AppResource appResource)
1638private async Task<(List<(string Value, bool IsSensitive)>, bool)> BuildArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1666private async Task<List<ContainerCreateFileSystem>> BuildCreateFilesAsync(IResource modelResource, CancellationToken cancellationToken)
1696private async Task<(List<EnvVar>, bool)> BuildEnvVarsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1723private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken)
1783private 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 (9)
20private readonly ILookup<IResource, IResource> _parentChildLookup;
169static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
182private async Task ProcessUrls(IResource resource, CancellationToken cancellationToken)
245async Task ProcessValueAsync(IResource resource, IValueProvider vp)
369private async Task SetChildResourceAsync(IResource resource, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp)
371foreach (var child in _parentChildLookup[resource])
413private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource)
424private 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 (40)
278public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource
294public static IResourceBuilder<T> WithPublishingCallback<T>(this IResourceBuilder<T> builder, Func<PublishingContext, Task> callback) where T : IResource
310public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
767where T : IResource
790where T : IResource
811where T : IResource
832where T : IResource
854where T : IResource
909where T : IResource
980public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource
998/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results
1014public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport
1034/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results
1042/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para>
1056public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport
1064private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
1066if (builder.Resource as IResource == dependency.Resource)
1091foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>())
1126public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource
1157public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport
1162if (builder.Resource as IResource == dependency.Resource)
1187/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource
1213public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource
1412CommandOptions? commandOptions = null) where T : IResource
1479bool isHighlighted = false) where T : IResource
1822IResource resource,
1823string type) where T : IResource
1841IResource resource) where T : IResource
1858ReferenceExpression expression) where T : IResource
1869where T : IResource
1873void AddReference(IResource resource)
1885if (value is IResource resource)
1889else if (value is IResourceBuilder<IResource> resourceBuilder)
1917IResourceBuilder<IResource> resourceBuilder) where T : IResource
1950IResourceBuilder<IResource> parent) where T : IResource
1980IResource parent) where T : IResource
Aspire.Hosting.Azure (21)
AzureResourcePreparer.cs (11)
51internal static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel)
58var azureResources = new List<(IResource, IAzureResource)>();
59foreach (var resource in appModel.Resources)
90foreach (var resource in appModel.Resources)
99private async Task BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List<(IResource Resource, IAzureResource AzureResource)> azureResources, AzureProvisioningOptions options, CancellationToken cancellationToken)
125foreach (var resource in resourceSnapshot)
217static bool IsResourceValidForRoleAssignments(IResource resource)
223private static Dictionary<AzureProvisioningResource, IEnumerable<RoleDefinition>> GetAllRoleAssignments(IResource resource)
238IResource resource,
255IResource resource,
326private async Task<HashSet<IAzureResource>> GetAzureReferences(IResource resource, CancellationToken cancellationToken)
Provisioning\Provisioners\AzureProvisioner.cs (6)
44private ILookup<IResource, IResourceWithParent>? _parentChildLookup;
64async Task UpdateStateAsync((IResource Resource, IAzureResource AzureResource) resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
97async Task AfterProvisionAsync((IResource Resource, IAzureResource AzureResource) resource)
131async Task<bool> WaitForRoleAssignments((IResource Resource, IAzureResource AzureResource) resource)
198IList<(IResource Resource, IAzureResource AzureResource)> azureResources,
255private 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 (17)
Aspire.Hosting.Azure.AppService (6)
Aspire.Hosting.Azure.CognitiveServices (3)
Aspire.Hosting.Azure.ContainerRegistry (4)
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 (38)
Aspire.Hosting.Azure.WebPubSub (3)
Aspire.Hosting.Containers.Tests (10)
Aspire.Hosting.Docker (11)
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 (26)
Aspire.Playground.Tests (3)
Stress.AppHost (5)