18 interfaces inheriting from IResource
Aspire.Hosting (13)
ApplicationModel\IComputeEnvironmentResource.cs (1)
11public interface IComputeEnvironmentResource : IResource
ApplicationModel\IComputeResource.cs (1)
13public interface IComputeResource : IResource
ApplicationModel\IContainerFilesDestinationResource.cs (1)
15public interface IContainerFilesDestinationResource : IResource
ApplicationModel\IResourceWithArgs.cs (1)
9public interface IResourceWithArgs : IResource
ApplicationModel\IResourceWithConnectionString.cs (1)
9public interface IResourceWithConnectionString : IResource, IManifestExpressionProvider, IValueProvider, IValueWithReferences
ApplicationModel\IResourceWithContainerFiles.cs (1)
15public interface IResourceWithContainerFiles : IResource
ApplicationModel\IResourceWithEndpoints.cs (1)
9public interface IResourceWithEndpoints : IResource
ApplicationModel\IResourceWithEnvironment.cs (1)
9public interface IResourceWithEnvironment : IResource
ApplicationModel\IResourceWithoutLifetime.cs (1)
9public interface IResourceWithoutLifetime : IResource
ApplicationModel\IResourceWithParameters.cs (1)
12public interface IResourceWithParameters : IResource
ApplicationModel\IResourceWithParentOfT.cs (1)
23public interface IResourceWithParent : IResource
ApplicationModel\IResourceWithProbes.cs (1)
12public interface IResourceWithProbes : IResource
ApplicationModel\IResourceWithWaitSupport.cs (1)
9public interface IResourceWithWaitSupport : IResource
Aspire.Hosting.Azure (5)
IAzureDelegatedSubnetResource.cs (1)
13public interface IAzureDelegatedSubnetResource : IResource
IAzureKeyVaultResource.cs (1)
11public interface IAzureKeyVaultResource : IResource, IAzureResource
IAzurePrivateEndpointTarget.cs (1)
13public interface IAzurePrivateEndpointTarget : IResource
IAzureResource.cs (1)
10public interface IAzureResource : IResource
IResourceWithAzureFunctionsConfig.cs (1)
11public interface IResourceWithAzureFunctionsConfig : IResource
11 implementations of IResource
Aspire.Hosting (1)
ApplicationModel\Resource.cs (1)
12public abstract class Resource : IResource
Aspire.Hosting.Azure.AppConfiguration (1)
AzureAppConfigurationEmulatorResource.cs (1)
12public class AzureAppConfigurationEmulatorResource(AzureAppConfigurationResource innerResource) : ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Azure.CosmosDB (1)
AzureCosmosDBEmulatorResource.cs (1)
13: ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Azure.EventHubs (1)
AzureEventHubsEmulatorResource.cs (1)
13: ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Azure.ServiceBus (1)
AzureServiceBusEmulatorResource.cs (1)
12public class AzureServiceBusEmulatorResource(AzureServiceBusResource innerResource) : ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Azure.SignalR (1)
AzureSignalREmulatorResource.cs (1)
12public class AzureSignalREmulatorResource(AzureSignalRResource innerResource) : ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Azure.Storage (1)
AzureStorageEmulatorResource.cs (1)
12public class AzureStorageEmulatorResource(AzureStorageResource innerResource) : ContainerResource(innerResource.Name), IResource
Aspire.Hosting.Tests (4)
DistributedApplicationBuilderTests.cs (1)
240private sealed class TestResource : IResource
DistributedApplicationModelExtensionsTests.cs (1)
70private sealed class CustomResource : IResource
Eventing\DistributedApplicationBuilderEventingTests.cs (1)
342private sealed class TestResource(string name) : IResource
Utils\VolumeNameGeneratorTests.cs (1)
46private sealed class TestResource(string name) : IResource
946 references to IResource
Aspire.Hosting (460)
ApplicationModel\ArgumentsExecutionConfigurationGatherer.cs (1)
14public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\BeforeResourceStartedEvent.cs (2)
16public class BeforeResourceStartedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 19public IResource Resource { get; } = resource;
ApplicationModel\CertificateTrustConfigurationCallbackAnnotation.cs (1)
31public required IResource Resource { get; init; }
ApplicationModel\CertificateTrustExecutionConfigurationGatherer.cs (1)
31public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\CommandLineArgsCallbackAnnotation.cs (3)
54private readonly IResource? _resource; 62public CommandLineArgsCallbackContext(IList<object> args, IResource resource, CancellationToken cancellationToken = default) 92public IResource Resource => _resource ?? throw new InvalidOperationException($"{nameof(Resource)} is not set. This callback context is not associated with a resource.");
ApplicationModel\CommandsConfigurationExtensions.cs (1)
12internal static void AddLifeCycleCommands(this IResource resource)
ApplicationModel\ConnectionStringAvailableEvent.cs (3)
11/// <param name="resource">The <see cref="IResource"/> for the event.</param> 13public class ConnectionStringAvailableEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 16public IResource Resource => resource;
ApplicationModel\ContainerBuildOptionsCallbackAnnotation.cs (2)
51IResource resource, 67public IResource Resource { get; }
ApplicationModel\ContainerFilesDestinationAnnotation.cs (1)
20public required IResource Source { get; init; }
ApplicationModel\ContainerFileSystemCallbackAnnotation.cs (1)
279public required IResource Model { get; init; }
ApplicationModel\ContainerImagePushOptionsCallbackContext.cs (1)
26public required IResource Resource { get; init; }
ApplicationModel\ContainerImageReference.cs (2)
21public ContainerImageReference(IResource resource) 29public IResource Resource { get; }
ApplicationModel\ContainerPortReference.cs (2)
12public class ContainerPortReference(IResource resource) : IManifestExpressionProvider, IValueWithReferences, IValueProvider 17public IResource Resource { get; } = resource;
ApplicationModel\CustomResourceSnapshot.cs (1)
428public static ImmutableArray<RelationshipSnapshot> BuildRelationships(IResource resource)
ApplicationModel\DeploymentTargetAnnotation.cs (2)
9public sealed class DeploymentTargetAnnotation(IResource target) : IResourceAnnotation 14public IResource DeploymentTarget { get; set; } = target;
ApplicationModel\DistributedApplicationModel.cs (1)
21public DistributedApplicationModel(IEnumerable<IResource> resources) : this(new ResourceCollection(resources)) { }
ApplicationModel\DistributedApplicationModelExtensions.cs (9)
16/// <returns>An enumerable of compute <see cref="IResource"/> in the model.</returns> 17public static IEnumerable<IResource> GetComputeResources(this DistributedApplicationModel model) 19foreach (var r in model.Resources) 45/// <returns>An enumerable of build <see cref="IResource"/> in the model.</returns> 46public static IEnumerable<IResource> GetBuildResources(this DistributedApplicationModel model) 48foreach (var r in model.Resources) 62/// <returns>An enumerable of build and push <see cref="IResource"/> in the model.</returns> 63public static IEnumerable<IResource> GetBuildAndPushResources(this DistributedApplicationModel model) 65foreach (var r in model.Resources)
ApplicationModel\Docker\ContainerFilesExtensions.cs (6)
23public static DockerfileBuilder AddContainerFilesStages(this DockerfileBuilder builder, IResource resource, ILogger? logger) 32var source = containerFileDestination.Source; 80public static DockerfileStage AddContainerFiles(this DockerfileStage stage, IResource resource, string rootDestinationPath, ILogger? logger) 90var source = containerFileDestination.Source; 121private static string GetSourceImageArgName(IResource source) => $"{source.Name.Replace("-", "_").ToUpperInvariant()}_IMAGENAME"; 124private static string GetSourceStageName(IResource source) => $"{source.Name.Replace("-", "_")}_stage";
ApplicationModel\DockerfileBuilderCallbackContext.cs (2)
22public DockerfileBuilderCallbackContext(IResource resource, DockerfileBuilder builder, IServiceProvider services, CancellationToken cancellationToken) 33public IResource Resource { get; }
ApplicationModel\DockerfileFactoryContext.cs (1)
37public required IResource Resource { get; init; }
ApplicationModel\EnvironmentCallbackContext.cs (3)
18private readonly IResource? _resource; 27public EnvironmentCallbackContext(DistributedApplicationExecutionContext executionContext, IResource resource, Dictionary<string, object>? environmentVariables = null, CancellationToken cancellationToken = default) 56public IResource Resource => _resource ?? throw new InvalidOperationException($"{nameof(Resource)} is not set. This callback context is not associated with a resource.");
ApplicationModel\EnvironmentVariablesConfigurationGatherer.cs (1)
14public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\ExecutionConfigurationBuilder.cs (3)
40private readonly IResource _resource; 43private ExecutionConfigurationBuilder(IResource resource) 79public static IExecutionConfigurationBuilder Create(IResource resource)
ApplicationModel\ExecutionConfigurationGathererContext.cs (1)
38IResource resource,
ApplicationModel\HttpsCertificateConfigurationCallbackAnnotaion.cs (1)
35public required IResource Resource { get; init; }
ApplicationModel\HttpsCertificateExecutionConfigurationGatherer.cs (1)
30public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\IExecutionConfigurationGatherer.cs (1)
23ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default);
ApplicationModel\InitializeResourceEvent.cs (2)
22IResource resource, 29public IResource Resource { get; } = resource;
ApplicationModel\IRequiredCommandValidator.cs (1)
30Task<RequiredCommandValidationResult> ValidateAsync(IResource resource, RequiredCommandAnnotation annotation, CancellationToken cancellationToken);
ApplicationModel\IResourceBuilder.cs (1)
10public interface IResourceBuilder<out T> where T : IResource
ApplicationModel\IResourceCollection.cs (1)
9public interface IResourceCollection : IList<IResource>
ApplicationModel\IResourceWithParentOfT.cs (3)
10public interface IResourceWithParent<out T> : IResourceWithParent where T : IResource 17IResource IResourceWithParent.Parent => Parent; 28IResource Parent { get; }
ApplicationModel\IValueProvider.cs (1)
19public IResource? Caller { get; init; }
ApplicationModel\ReferenceExpression.cs (5)
220where T : IResource, IValueProvider, IManifestExpressionProvider 232where T : IResource, IValueProvider, IManifestExpressionProvider 395var unwrapped = valueProvider is IResourceBuilder<IResource> rb ? rb.Resource : valueProvider; 499where T : IResource, IValueProvider, IManifestExpressionProvider 511where T : IResource, IValueProvider, IManifestExpressionProvider
ApplicationModel\RequiredCommandValidator.cs (1)
51IResource resource,
ApplicationModel\Resource.cs (1)
9/// Represents an abstract resource that can be used by an application, that implements <see cref="IResource"/>.
ApplicationModel\ResourceAnnotationMutationBehavior.cs (1)
8/// method when adding an annotation to the <see cref="IResource.Annotations"/> collection of a resource.
ApplicationModel\ResourceCollection.cs (11)
13private readonly List<IResource> _resources = []; 17public ResourceCollection(IEnumerable<IResource> resources) => _resources.AddRange(resources); 19public IResource this[int index] { get => _resources[index]; set => _resources[index] = value; } 22public void Add(IResource item) => _resources.Add(item); 24public bool Contains(IResource item) => _resources.Contains(item); 25public void CopyTo(IResource[] array, int arrayIndex) => _resources.CopyTo(array, arrayIndex); 26public IEnumerator<IResource> GetEnumerator() => _resources.GetEnumerator(); 27public int IndexOf(IResource item) => _resources.IndexOf(item); 28public void Insert(int index, IResource item) => _resources.Insert(index, item); 29public bool Remove(IResource item) => _resources.Remove(item); 42public required IResource Resource { get; init; }
ApplicationModel\ResourceCommandService.cs (2)
62public async Task<ExecuteCommandResult> ExecuteCommandAsync(IResource resource, string commandName, CancellationToken cancellationToken = default) 120internal async Task<ExecuteCommandResult> ExecuteCommandCoreAsync(string resourceId, IResource resource, string commandName, CancellationToken cancellationToken)
ApplicationModel\ResourceEndpointsAllocatedEvent.cs (2)
14public class ResourceEndpointsAllocatedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 17public IResource Resource { get; } = resource;
ApplicationModel\ResourceExtensions.cs (71)
16/// Provides extension methods for the <see cref="IResource"/> interface. 27public static bool TryGetLastAnnotation<T>(this IResource resource, [NotNullWhen(true)] out T? annotation) where T : IResourceAnnotation 48public static bool TryGetAnnotationsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 70public static bool HasAnnotationOfType<T>(this IResource resource) where T : IResourceAnnotation 82public static bool TryGetAnnotationsIncludingAncestorsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 119public static bool HasAnnotationIncludingAncestorsOfType<T>(this IResource resource) where T : IResourceAnnotation 152public static bool TryGetEnvironmentVariables(this IResource resource, [NotNullWhen(true)] out IEnumerable<EnvironmentCallbackAnnotation>? environmentVariables) 258this IResource resource, 293this IResource resource, 333this IResource resource, 356this IResource resource, 390this IResource resource, 426this IResource resource, 448this IResource resource, 483where T : IResource, IComputeResource 502where T : IResource, IComputeResource 510internal static NetworkIdentifier GetDefaultResourceNetwork(this IResource resource) 515internal static IEnumerable<NetworkIdentifier> GetSupportedNetworks(this IResource resource) 521this IResource resource, 532(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await resource.GetValue(executionContext, key, provider, logger, cancellationToken).ConfigureAwait(false), 534(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false), 544public static bool IsExcludedFromPublish(this IResource resource) => 548this IResource resource, 591private static async Task<ResolvedValue?> GetValue(this IResource resource, DistributedApplicationExecutionContext executionContext, string? key, IValueProvider valueProvider, ILogger logger, CancellationToken cancellationToken) 597if (valueProvider is IResource providerResource) 634public static bool TryGetContainerMounts(this IResource resource, [NotNullWhen(true)] out IEnumerable<ContainerMountAnnotation>? volumeMounts) 645public static bool TryGetEndpoints(this IResource resource, [NotNullWhen(true)] out IEnumerable<EndpointAnnotation>? endpoints) 656public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls) 665/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 681/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 744public static IReadOnlyList<ResolvedEndpoint> ResolveEndpoints(this IResource resource, IPortAllocator? portAllocator = null) 827public static bool TryGetContainerImageName(this IResource resource, [NotNullWhen(true)] out string? imageName) 839public static bool TryGetContainerImageName(this IResource resource, bool useBuiltImage, [NotNullWhen(true)] out string? imageName) 880public static int GetReplicaCount(this IResource resource) 901public static bool RequiresImageBuild(this IResource resource) 921public static bool RequiresImageBuildAndPush(this IResource resource) 926internal static bool IsBuildOnlyContainer(this IResource resource) 937public static IComputeEnvironmentResource? GetComputeEnvironment(this IResource resource) 950public static DeploymentTargetAnnotation? GetDeploymentTargetAnnotation(this IResource resource, IComputeEnvironmentResource? targetComputeEnvironment = null) 995internal static ContainerLifetime GetContainerLifetimeType(this IResource resource) 1011internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy) 1029internal static bool SupportsProxy(this IResource resource) 1039internal static IResource GetRootResource(this IResource resource) => 1050internal static string GetResolvedResourceName(this IResource resource) 1071internal static bool TryGetInstances(this IResource resource, out ImmutableArray<DcpInstance> instances) 1088internal static string[] GetResolvedResourceNames(this IResource resource) 1108this IResource resource, 1148internal static IContainerRegistry GetContainerRegistry(this IResource resource) 1173var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 1195this IResource resource, 1224internal static ILogger GetLogger(this IResource resource, IServiceProvider serviceProvider) 1257public static async Task<IReadOnlySet<IResource>> GetResourceDependenciesAsync( 1258this IResource resource, 1263var dependencies = new HashSet<IResource>(); 1264var newDependencies = new HashSet<IResource>(); 1270var toProcess = new Queue<IResource>(dependencies); 1273var dep = toProcess.Dequeue(); 1278foreach (var newDep in newDependencies) 1301IResource resource, 1302HashSet<IResource> dependencies, 1303HashSet<IResource> newDependencies, 1325IResource resource, 1369private static void CollectAnnotationDependencies(IResource resource, HashSet<IResource> dependencies, HashSet<IResource> newDependencies) 1405private static void CollectDependenciesFromValue(object? value, HashSet<IResource> dependencies, HashSet<IResource> newDependencies, HashSet<object> visitedValues) 1413if (value is IResource resource) 1423if (value is IResourceBuilder<IResource> resourceBuilder) 1447internal static string GetResourceType(this IResource resource) => resource switch
ApplicationModel\ResourceLoggerService.cs (5)
49public ILogger GetLogger(IResource resource) 157public IAsyncEnumerable<IReadOnlyList<LogLine>> GetAllAsync(IResource resource) 177public IAsyncEnumerable<IReadOnlyList<LogLine>> WatchAsync(IResource resource) 270/// <param name="resource">The <see cref="IResource"/>.</param> 271public void Complete(IResource resource)
ApplicationModel\ResourceNotificationService.cs (19)
139private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken) 266private async Task WaitUntilCompletionAsync(IResource resource, IResource dependency, int exitCode, CancellationToken cancellationToken) 325private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, 396private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken) 414public async Task WaitForDependenciesAsync(IResource resource, CancellationToken cancellationToken) 619public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 719private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState) 793private static CustomResourceSnapshot UpdateIcons(IResource resource, CustomResourceSnapshot previousState) 823public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 832private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState) 860private ResourceNotificationState GetResourceNotificationState(string resourceId, IResource resource) => 936private sealed class ResourceNotificationState(IResource resource) 941public IResource Resource { get; } = resource; 968public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot) 973public IResource Resource { get; } = resource;
ApplicationModel\ResourceReadyEvent.cs (2)
16public class ResourceReadyEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 21public IResource Resource => resource;
ApplicationModel\ResourceRelationshipAnnotation.cs (2)
12public sealed class ResourceRelationshipAnnotation(IResource resource, string type) : IResourceAnnotation 17public IResource Resource { get; } = resource;
ApplicationModel\ResourceStoppedEvent.cs (2)
17public class ResourceStoppedEvent(IResource resource, IServiceProvider services, ResourceEvent resourceEvent) : IDistributedApplicationResourceEvent 20public IResource Resource { get; } = resource;
ApplicationModel\ResourceUrlsCallbackContext.cs (2)
17public class ResourceUrlsCallbackContext(DistributedApplicationExecutionContext executionContext, IResource resource, List<ResourceUrlAnnotation>? urls = null, CancellationToken cancellationToken = default) 22public IResource Resource { get; } = resource;
ApplicationModel\WaitAnnotation.cs (2)
18public sealed class WaitAnnotation(IResource resource, WaitType waitType, int exitCode = 0) : IResourceAnnotation 23public IResource Resource { get; } = resource;
Ats\AtsCapabilityInfo.cs (1)
63public bool IsResourceBuilder => ClrType != null && typeof(IResource).IsAssignableFrom(ClrType);
Ats\AtsTypeMappings.cs (1)
29[assembly: AspireExport(typeof(IResource))]
Ats\CoreExports.cs (1)
104public static string GetResourceName(IResourceBuilder<IResource> resource)
Ats\LoggingExports.cs (1)
74public static void CompleteLog(ResourceLoggerService loggerService, IResourceBuilder<IResource> resource)
Ats\NotificationExports.cs (2)
55IResourceBuilder<IResource> resource) 81IResourceBuilder<IResource> resource,
Backchannel\AuxiliaryBackchannelRpcTarget.cs (4)
356foreach (var resource in appModel.Resources) 416var resource = resourceEvent.Resource; 572var resource = appModel?.Resources.FirstOrDefault(r => StringComparers.ResourceName.Equals(r.Name, resourceName)); 674foreach (var resource in appModel.Resources)
BuiltInDistributedApplicationEventSubscriptionHandlers.cs (2)
18foreach (var container in beforeStartEvent.Model.GetContainerResources()) 54foreach (var resource in beforeStartEvent.Model.Resources)
ConnectionStringBuilderExtensions.cs (3)
59if (value is IResource resource) 69foreach (var innerRef in valueWithReferences.References.OfType<IResource>())
ContainerRegistryResourceBuilderExtensions.cs (3)
123foreach (var resource in beforeStartEvent.Model.Resources) 157where TDestination : IResource 158where TContainerRegistry : IResource, IContainerRegistry
ContainerResourceBuilderExtensions.cs (1)
1537public static IResourceBuilder<T> WithDockerfileBaseImage<T>(this IResourceBuilder<T> builder, string? buildImage = null, string? runtimeImage = null) where T : IResource
ContainerResourceExtensions.cs (3)
18public static IEnumerable<IResource> GetContainerResources(this DistributedApplicationModel model) 22foreach (var resource in model.Resources) 36public static bool IsContainer(this IResource resource)
CustomResourceExtensions.cs (1)
21where TResource : IResource
Dashboard\DashboardEventHandlers.cs (1)
355private void ConfigureAspireDashboardResource(IResource dashboardResource)
Dashboard\DashboardServiceData.cs (1)
40static GenericResourceSnapshot CreateResourceSnapshot(IResource resource, string resourceId, DateTime creationTimestamp, CustomResourceSnapshot snapshot)
Dashboard\ResourcePublisher.cs (3)
19private sealed record SourceAndResourceSnapshot(IResource Source, ResourceSnapshot Snapshot); 28internal bool TryGetResource(string resourceName, [NotNullWhen(returnValue: true)] out ResourceSnapshot? snapshot, [NotNullWhen(returnValue: true)] out IResource? resource) 84internal async ValueTask IntegrateAsync(IResource source, ResourceSnapshot snapshot, ResourceSnapshotChangeType changeType)
Dcp\AppResource.cs (4)
53public IResource ModelResource { get; } 55public RenderedModelResource(IResource modelResource, CustomResource dcpResource): base(dcpResource) 78public ServiceWithModelResource(IResource modelResource, Service service, EndpointAnnotation sba) : base(modelResource, service) 86IResource ModelResource { get; }
Dcp\DcpExecutor.cs (16)
439_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource)) 544private static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource 731_resourceState.ApplicationModel.TryGetValue(appModelResourceName, out var appModelResource)) 1449private void EnsureRequiredAnnotations(IResource resource) 1457private static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder) 1489var groupKey = group.Key; 1504IResource resource, 1825foreach (var container in modelContainerResources) 1891private static DcpInstance GetDcpInstance(IResource resource, int instanceIndex) 1981var modelContainerResource = cr.ModelResource; 2187private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, IServiceProvider serviceProvider, CancellationToken cancellationToken) 2268private void AddServicesProducedInfo(IResource modelResource, IAnnotationHolder dcpResource, RenderedModelResource appResource) 2567public required IResource Resource { get; init; } 2610private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken) 2833private static List<VolumeMount> BuildContainerMounts(IResource container) 2856private static bool TryGetEndpoint(IResource resource, string? endpointName, [NotNullWhen(true)] out EndpointAnnotation? endpoint)
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);
Dcp\DcpNameGenerator.cs (6)
28public void EnsureDcpInstancesPopulated(IResource resource) 58private static void AddInstancesAnnotation(IResource resource, ImmutableArray<DcpInstance> instances) 63public (string Name, string Suffix) GetContainerName(IResource container) 74public (string Name, string Suffix) GetExecutableName(IResource project) 80public string GetServiceName(IResource resource, EndpointAnnotation endpoint, bool hasMultipleEndpoints, HashSet<string> allServiceNames) 122public static string GetObjectNameForResource(IResource resource, DcpOptions options, string suffix = "")
Dcp\DcpResourceState.cs (2)
10internal sealed class DcpResourceState(Dictionary<string, IResource> applicationModel, List<AppResource> appResources) 19public Dictionary<string, IResource> ApplicationModel { get; } = applicationModel;
Dcp\ResourceSnapshotBuilder.cs (4)
39_resourceState.ApplicationModel.TryGetValue(container.AppModelResourceName, out var appModelResource)) 96IResource? appModelResource = null; 132IResource? appModelResource = null; 237_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource) &&
DistributedApplication.cs (2)
610foreach (var resource in app._model.Resources) 626public required IResource Resource { get; init; }
DistributedApplicationBuilder.cs (2)
747public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource 761public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource
DistributedApplicationBuilderExtensions.cs (4)
61public static IResourceBuilder<T> CreateResourceBuilder<T>(this IDistributedApplicationBuilder builder, string name) where T : IResource 65var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase)); 91public static bool TryCreateResourceBuilder<T>(this IDistributedApplicationBuilder builder, string name, [NotNullWhen(true)] out IResourceBuilder<T>? resourceBuilder) where T : IResource 96var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase));
DistributedApplicationEventingExtensions.cs (5)
22where T : IResource 33where T : IResource 55where T : IResource 77where T : IResource 81where TResource : IResource
DistributedApplicationResourceBuilder.cs (1)
8internal sealed class DistributedApplicationResourceBuilder<T>(IDistributedApplicationBuilder applicationBuilder, T resource) : IResourceBuilder<T> where T : IResource
EmulatorResourceExtensions.cs (1)
18public static bool IsEmulator(this IResource resource)
Eventing\DistributedApplicationEventing.cs (1)
106public DistributedApplicationEventSubscription Subscribe<T>(IResource resource, Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationResourceEvent
Eventing\DistributedApplicationEventSubscription.cs (2)
25public class DistributedApplicationResourceEventSubscription(IResource? resource, Func<IDistributedApplicationResourceEvent, CancellationToken, Task> callback) 31public IResource? Resource { get; } = resource;
Eventing\IDistributedApplicationEvent.cs (1)
27IResource Resource { get; }
Eventing\IDistributedApplicationEventing.cs (1)
29DistributedApplicationEventSubscription Subscribe<T>(IResource resource, Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationResourceEvent;
Exec\ExecEventingHandlers.cs (1)
14var resource = execResourceManager.CreateExecResource();
Exec\ExecResourceManager.cs (9)
23private readonly TaskCompletionSource<IResource> _execResourceInitialized = new(); 57IResource? execResource = null; 156public IResource? CreateExecResource() 165var targetResource = _model.Resources.FirstOrDefault(x => x.Name.Equals(_execOptions.ResourceName, StringComparisons.ResourceName)); 172var execResource = BuildResource(targetResource); 186IResource BuildResource(IResource targetExecResource) 196private IResource BuildAgainstResource(ProjectResource project) 243private IResource BuildAgainstResource(ContainerResource container)
Health\ResourceHealthCheckService.cs (2)
106var resource = state.LatestEvent.Resource; 243private void FireResourceReadyEvent(IResource resource, CancellationToken cancellationToken)
IDistributedApplicationBuilder.cs (4)
188/// constructs a resource derived from <see cref="IResource"/> and adds it to the application model using the <see cref="AddResource{T}(T)"/> 201IResourceBuilder<T> AddResource<T>(T resource) where T : IResource; 221/// Calling extension methods on the <see cref="IResourceBuilder{T}"/> typically results in modifications to the <see cref="IResource.Annotations"/> 257IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource;
Lifecycle\RequiredCommandValidationLifecycleHook.cs (1)
33var resource = @event.Resource;
Orchestrator\ApplicationOrchestrator.cs (16)
24private readonly ILookup<IResource, IResource> _parentChildLookup; 140private async Task PublishResourceEndpointUrls(IResource resource, CancellationToken cancellationToken) 150private static IEnumerable<UrlSnapshot> GetResourceUrls(IResource resource) 201static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 214private async Task ProcessResourceUrlCallbacks(IResource resource, CancellationToken cancellationToken) 596private async Task SetChildResourceAsync(IResource resource, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp) 598foreach (var child in _parentChildLookup[resource].Where(c => c is IResourceWithParent)) 625foreach (var resource in _model.Resources) 629var parent = resource is IResourceWithParent hasParent 651private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource) 662private async Task PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken) 688private async Task PublishEventToHierarchy<TEvent>(Func<IResource, TEvent> createEvent, IResource resource, CancellationToken cancellationToken) 697foreach (var child in children.Where(c => c is IResourceWithParent)) 712private static bool ResourceHasOwnLifetime(IResource resource) =>
Orchestrator\ParameterProcessor.cs (1)
128foreach (var resource in model.Resources)
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))
OtlpConfigurationExtensions.cs (3)
22public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment) 41public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment, OtlpProtocol protocol) 53private static void RegisterOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment)
Pipelines\DistributedApplicationPipeline.cs (5)
125foreach (var resource in context.Model.GetBuildResources()) 172foreach (var resource in context.Model.Resources) 220var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 483foreach (var resource in context.Model.Resources) 518foreach (var resource in pipelineContext.Model.Resources)
Pipelines\IPipelineOutputService.cs (2)
27string GetOutputDirectory(IResource resource); 40string GetTempDirectory(IResource resource);
Pipelines\PipelineConfigurationContext.cs (3)
41internal ILookup<IResource?, PipelineStep>? StepToResourceMap { get; init; } 59public IEnumerable<PipelineStep> GetSteps(IResource resource) 72public IEnumerable<PipelineStep> GetSteps(IResource resource, string tag)
Pipelines\PipelineOutputService.cs (2)
43public string GetOutputDirectory(IResource resource) 58public string GetTempDirectory(IResource resource)
Pipelines\PipelineStep.cs (1)
57public IResource? Resource { get; set; }
Pipelines\PipelineStepFactoryContext.cs (1)
23public required IResource Resource { get; init; }
Pipelines\PipelineStepFactoryExtensions.cs (6)
24Func<PipelineStepFactoryContext, PipelineStep> factory) where T : IResource 41Func<PipelineStepFactoryContext, Task<PipelineStep>> factory) where T : IResource 58Func<PipelineStepFactoryContext, IEnumerable<PipelineStep>> factory) where T : IResource 75Func<PipelineStepFactoryContext, Task<IEnumerable<PipelineStep>>> factory) where T : IResource 93Func<PipelineConfigurationContext, Task> callback) where T : IResource 111Action<PipelineConfigurationContext> callback) where T : IResource
Pipelines\PipelineStepHelpers.cs (3)
29public static async Task PushImageToRegistryAsync(IResource resource, PipelineStepContext context) 63private static async Task TagImageForLocalRegistryAsync(IResource resource, PipelineStepContext context) 106private static async Task PushImageToRemoteRegistryAsync(IResource resource, IContainerRegistry registry, PipelineStepContext context)
Publishing\ContainerRuntimeBase.cs (1)
68public virtual async Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\IContainerRuntime.cs (1)
59Task PushImageAsync(IResource resource, CancellationToken cancellationToken);
Publishing\ManifestPublishingContext.cs (22)
44private readonly Dictionary<string, IResource> _referencedResources = []; 82foreach (var resource in model.Resources) 91foreach (var resource in model.Resources) 109internal async Task WriteResourceAsync(IResource resource) 145async Task WriteResourceObjectAsync<T>(T resource, Func<Task> action) where T : IResource 219private void WriteContainerFilesDestination(IResource resource) 230var source = containerFileDestination.Source; 468/// <param name="resource">The <see cref="IResource"/>.</param> 469public void WriteConnectionString(IResource resource) 481/// <see cref="EndpointAnnotation"/> entries in the <see cref="IResource.Annotations"/> 484/// <param name="resource">The <see cref="IResource"/> that contains <see cref="EndpointAnnotation"/> annotations.</param> 485public void WriteBindings(IResource resource) 526/// Writes environment variables to the manifest base on the <see cref="IResource"/> resource's <see cref="EnvironmentCallbackAnnotation"/> annotations."/> 528/// <param name="resource">The <see cref="IResource"/> which contains <see cref="EnvironmentCallbackAnnotation"/> annotations.</param> 529public async Task WriteEnvironmentVariablesAsync(IResource resource) 563/// Writes command line arguments to the manifest based on the <see cref="IResource"/> resource's <see cref="CommandLineArgsCallbackAnnotation"/> annotations. 565/// <param name="resource">The <see cref="IResource"/> that contains <see cref="CommandLineArgsCallbackAnnotation"/> annotations.</param> 567public async Task WriteCommandLineArgumentsAsync(IResource resource) 659/// Ensures that any <see cref="IResource"/> instances referenced by <paramref name="value"/> are 670if (value is IResource resource) 867foreach (var existingResource in model.Resources) 873foreach (var resource in _referencedResources.Values)
Publishing\ResourceContainerImageManager.cs (13)
141Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default); 149Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default); 156Task PushImageAsync(IResource resource, CancellationToken cancellationToken); 181IResource resource, 206public async Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 226foreach (var resource in resources) 235public async Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 295private async Task BuildProjectContainerImageAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 322private async Task<bool> ExecuteDotnetPublishAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 419private async Task BuildContainerImageFromDockerfileAsync(IResource resource, DockerfileBuildAnnotation dockerfileBuildAnnotation, string imageName, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 513public async Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 519private async Task<bool> ResourcesRequireContainerRuntimeAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken) 521foreach (var resource in resources)
RequiredCommandResourceExtensions.cs (2)
31string? helpLink = null) where T : IResource 66string? helpLink = null) where T : IResource
ResourceBuilderExtensions.cs (58)
408public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource 424public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource 1133where T : IResource 1157where T : IResource 1195where T : IResource 1234where T : IResource 1257where T : IResource 1313where T : IResource 1453public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource 1471/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results 1488public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 1508/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results 1516/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 1530public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 1538private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 1540if (builder.Resource as IResource == dependency.Resource) 1580/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>, this method 1594public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 1614/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/>, this method 1620/// behavior with the <see cref="WaitForStart{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 1634public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 1642private static IResourceBuilder<T> WaitForStartCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 1644if (builder.Resource as IResource == dependency.Resource) 1669foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>()) 1705public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource 1737public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport 1742if (builder.Resource as IResource == dependency.Resource) 1767/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource 1794public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource 1995CommandOptions? commandOptions = null) where T : IResource 2062bool isHighlighted = false) where T : IResource 2701IResource resource, 2702string type) where T : IResource 2720IResource resource) where T : IResource 2737ReferenceExpression expression) where T : IResource 2748where T : IResource 2752void AddReference(IResource resource) 2764if (value is IResource resource) 2768else if (value is IResourceBuilder<IResource> resourceBuilder) 2796IResourceBuilder<IResource> resourceBuilder) where T : IResource 2830IResourceBuilder<IResource> parent) where T : IResource 2860IResource parent) where T : IResource 2891IResourceBuilder<IResource> child) where T : IResource 2923IResource child) where T : IResource 2957public static IResourceBuilder<T> WithIconName<T>(this IResourceBuilder<T> builder, string iconName, IconVariant iconVariant = IconVariant.Filled) where T : IResource 2993where T : IResource 3143public static IResourceBuilder<T> ExcludeFromMcp<T>(this IResourceBuilder<T> builder) where T : IResource 3179where T : IResource 3218where T : IResource 3250where T : IResource 3285where T : IResource
ResourceLoggerForwarderService.cs (1)
61private async Task WatchResourceLogs(IResource resource, string resourceId, CancellationToken cancellationToken)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Utils\DockerfileHelper.cs (1)
22IResource resource,
Utils\ExtensionUtils.cs (1)
16public static bool SupportsDebugging(this IResource builder, IConfiguration configuration, [NotNullWhen(true)] out SupportsDebuggingAnnotation? supportsDebuggingAnnotation)
Utils\ImageNameGenerator.cs (2)
12public static string GenerateImageName<T>(this IResourceBuilder<T> builder) where T : IResource 19public static string GenerateImageTag<T>(this IResourceBuilder<T> builder) where T : IResource
VolumeNameGenerator.cs (1)
21public static string Generate<T>(IResourceBuilder<T> builder, string suffix) where T : IResource
Aspire.Hosting.Azure (24)
AzurePublishingContext.cs (1)
310foreach (var resource in model.Resources)
AzureResourcePreparer.cs (11)
50internal static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel) 57var azureResources = new List<(IResource, IAzureResource)>(); 58foreach (var resource in appModel.Resources) 89foreach (var resource in appModel.Resources) 103private async Task BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List<(IResource Resource, IAzureResource AzureResource)> azureResources, CancellationToken cancellationToken) 129foreach (var resource in resourceSnapshot) 237static bool IsResourceValidForRoleAssignments(IResource resource) 243private static Dictionary<AzureProvisioningResource, IEnumerable<RoleDefinition>> GetAllRoleAssignments(IResource resource) 257IResource resource, 287IResource resource, 356private async Task<HashSet<IAzureResource>> GetAzureReferences(IResource resource, CancellationToken cancellationToken)
BicepResourceAnnotation.cs (1)
16/// that can be added to any <see cref="IResource"/> will be detected by the <see cref="AzureProvisioner"/> and used to
ExistingAzureResourceExtensions.cs (1)
20public static bool IsExisting(this IResource resource)
IAzureKeyVaultSecretReference.cs (2)
27/// The <see cref="IResource"/> that is responsible for writing this secret to the Key Vault, or <c>null</c> if not set. 32public IResource? SecretOwner
IAzureResource.cs (1)
7/// Represents an Azure resource, as a marker interface for <see cref="IResource"/>'s
Provisioning\Provisioners\AzureProvisioner.cs (7)
29private ILookup<IResource, IResourceWithParent>? _parentChildLookup; 43async Task UpdateStateAsync((IResource Resource, IAzureResource AzureResource) resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 78async Task AfterProvisionAsync((IResource Resource, IAzureResource AzureResource) resource) 112async Task<bool> WaitForRoleAssignments((IResource Resource, IAzureResource AzureResource) resource) 162IList<(IResource Resource, IAzureResource AzureResource)> azureResources, 187private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, (IResource Resource, IAzureResource AzureResource) resource, CancellationToken cancellationToken) 258async Task PublishConnectionStringAvailableEventRecursiveAsync(IResource targetResource)
Aspire.Hosting.Azure.AIFoundry (3)
AzureAIFoundryExtensions.cs (1)
191where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.AppConfiguration (3)
AzureAppConfigurationExtensions.cs (1)
190where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.AppContainers (24)
AzureContainerAppEnvironmentResource.cs (7)
57foreach (var computeResource in model.GetComputeResources()) 59var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 95foreach (var computeResource in context.Model.GetComputeResources()) 97var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 115foreach (var computeResource in context.Model.GetBuildResources()) 186internal Dictionary<string, (IResource resource, ContainerMountAnnotation volume, int index, BicepOutputReference outputReference)> VolumeNames { get; } = []; 258internal BicepOutputReference GetVolumeStorage(IResource resource, ContainerMountAnnotation volume, int volumeIndex)
AzureContainerAppResource.cs (2)
25public AzureContainerAppResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 102public IResource TargetResource { get; }
AzureContainerAppsInfrastructure.cs (2)
46foreach (var r in @event.Model.GetComputeResources()) 74foreach (var r in appModel.GetComputeResources())
BaseContainerAppContext.cs (3)
15internal abstract class BaseContainerAppContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext) 19public IResource Resource => resource; 89protected static bool TryGetContainerImageName(IResource resource, out string? containerImageName)
ContainerAppContext.cs (1)
14internal sealed class ContainerAppContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
ContainerAppEnvironmentContext.cs (4)
26private readonly Dictionary<IResource, BaseContainerAppContext> _containerApps = new(new ResourceNameComparer()); 64public BaseContainerAppContext GetContainerAppContext(IResource resource) 74public async Task<AzureBicepResource> CreateContainerAppAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken) 90private BaseContainerAppContext CreateContainerAppContext(IResource resource)
ContainerAppJobContext.cs (1)
14internal sealed class ContainerAppJobContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Azure.AppService (21)
AzureAppServiceEnvironmentContext.cs (3)
24private readonly Dictionary<IResource, AzureAppServiceWebsiteContext> _appServices = new(new ResourceNameComparer()); 26public AzureAppServiceWebsiteContext GetAppServiceContext(IResource resource) 36public async Task<AzureBicepResource> CreateAppServiceAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken)
AzureAppServiceEnvironmentResource.cs (8)
72foreach (var computeResource in model.GetComputeResources()) 74var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 110foreach (var computeResource in context.Model.GetComputeResources()) 112var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 130foreach (var computeResource in context.Model.GetBuildResources()) 173foreach (var computeResource in model.GetComputeResources()) 175var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 220private static string? ValidateEnvironmentVariableNames(IResource resource, AzureAppServiceWebsiteContext appServiceContext)
AzureAppServiceInfrastructure.cs (2)
51foreach (var resource in @event.Model.GetComputeResources()) 79foreach (var r in appModel.GetComputeResources())
AzureAppServiceWebsiteContext.cs (2)
18IResource resource, 21public IResource Resource => resource;
AzureAppServiceWebSiteResource.cs (2)
25public AzureAppServiceWebSiteResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 100public IResource TargetResource { get; }
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Azure.CognitiveServices (3)
AzureOpenAIExtensions.cs (1)
225where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ContainerRegistry (5)
AzureContainerRegistryExtensions.cs (3)
81foreach (var resource in beforeStartEvent.Model.Resources) 100where T : IResource, IComputeEnvironmentResource 123where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.EventHubs (3)
AzureEventHubsExtensions.cs (1)
503where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Functions (2)
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.KeyVault (5)
AzureKeyVaultResourceExtensions.cs (1)
173where T : IResource
AzureKeyVaultSecretReference.cs (1)
28public IResource? SecretOwner { get; set; }
AzureKeyVaultSecretResource.cs (1)
42IResource? IAzureKeyVaultSecretReference.SecretOwner { get; set; }
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Kusto (3)
AzureKustoBuilderExtensions.cs (1)
36/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Network (1)
AzurePrivateEndpointExtensions.cs (1)
76IResource rootResource = target.Resource;
Aspire.Hosting.Azure.Search (3)
AzureSearchExtensions.cs (1)
128where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ServiceBus (3)
AzureServiceBusExtensions.cs (1)
648where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.SignalR (3)
AzureSignalRExtensions.cs (1)
192where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Storage (3)
AzureStorageExtensions.cs (1)
678where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Tests (65)
AzureAppServiceTests.cs (3)
245var container = Assert.Single(model.GetContainerResources()); 281var container = Assert.Single(model.GetContainerResources()); 947private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepResourceTests.cs (6)
33public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensions => 36private static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> CreateAllAzureExtensions(string resourceName) 76public void AzureExtensionsAutomaticallyAddAzureProvisioning(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 88public void BicepResourcesAreIdempotent(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 104public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensionsWithHyphen => 109public void AzureResourcesProduceValidBicep(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
AzureContainerAppsTests.cs (40)
42var container = Assert.Single(model.GetContainerResources()); 76var container = Assert.Single(model.GetContainerResources()); 180var container = Assert.Single(model.GetContainerResources()); 223var container = Assert.Single(model.GetContainerResources()); 253var container = Assert.Single(model.GetContainerResources()); 446var container = Assert.Single(model.GetContainerResources()); 478var container = Assert.Single(model.GetContainerResources()); 512var container = Assert.Single(model.GetContainerResources()); 548var container = Assert.Single(model.GetContainerResources()); 586var container = Assert.Single(model.GetContainerResources()); 626var container = Assert.Single(model.GetContainerResources()); 658var container = Assert.Single(model.GetContainerResources()); 691var container = Assert.Single(model.GetContainerResources()); 742var container = Assert.Single(model.GetContainerResources()); 824var container = Assert.Single(model.GetContainerResources()); 867var container = Assert.Single(model.GetContainerResources()); 898var container = Assert.Single(model.GetContainerResources()); 930var container = Assert.Single(model.GetContainerResources()); 1201var container = Assert.Single(model.GetContainerResources()); 1232var container = Assert.Single(model.GetContainerResources()); 1263var container = Assert.Single(model.GetContainerResources()); 1549var container = Assert.Single(model.GetContainerResources()); 1572private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) => 1596var container = Assert.Single(model.GetContainerResources()); 1714var container = Assert.Single(model.GetContainerResources()); 1773var funcjob = model.Resources.Single(r => r.Name == "funcjob"); 1817var batch = containers.First(c => c.Name == "batch"); 1818var web = containers.First(c => c.Name == "web"); 1854var container = Assert.Single(model.GetContainerResources()); 1884var container = Assert.Single(model.GetContainerResources()); 1923var container = Assert.Single(model.GetContainerResources()); 1963var container = Assert.Single(model.GetContainerResources()); 2003var container = Assert.Single(model.GetContainerResources()); 2048var container = model.Resources.Single(r => r.Name == "api"); 2052var buildOnly = model.Resources.Single(r => r.Name == "build-only"); 2078var container = Assert.Single(model.GetContainerResources()); 2268var webappAcaResource = model.Resources.First(r => r.Name == "webappaca"); 2274var webappServiceResource = model.Resources.First(r => r.Name == "webappservice"); 2280var containerAcaResource = model.Resources.First(r => r.Name == "containeraca"); 2288var containerAppServiceResource = model.Resources.First(r => r.Name == "containerappservice");
AzureDeployerTests.cs (1)
182var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
AzureEventHubsExtensionsTests.cs (1)
517var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage");
AzureFunctionsTests.cs (1)
425private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureManagedRedisExtensionsTests.cs (1)
133var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureManifestUtils.cs (3)
15public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) => 18public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) => 21private static async Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource, bool skipPreparer)
AzurePostgresExtensionsTests.cs (2)
297var postgresResourceInModel = builder.Resources.Single(r => r.Name == "postgres-data"); 298var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
AzureProvisioningResourceTests.cs (1)
104var containerResource = Assert.Single(model.GetContainerResources());
AzureRedisExtensionsTests.cs (1)
177var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureServiceBusExtensionsTests.cs (1)
613var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql");
AzureSqlExtensionsTests.cs (2)
217var sqlResourceInModel = builder.Resources.Single(r => r.Name == "sql"); 218var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
ContainerRegistryTests.cs (1)
155foreach (var resource in model.Resources)
RoleAssignmentTests.cs (1)
336private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.Azure.WebPubSub (3)
AzureWebPubSubExtensions.cs (1)
286where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.CodeGeneration.Go (1)
AtsGoCodeGenerator.cs (1)
576typeof(IResource).IsAssignableFrom(typeInfo.ClrType);
Aspire.Hosting.CodeGeneration.Go.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
71bool enabled = true) where T : IResource 84double multiplier = 1.5) where T : IResource 375TestConfigDto config) where T : IResource 427DateTime createdAt) where T : IResource 438DateTimeOffset modifiedAt) where T : IResource 449Guid correlationId) where T : IResource 460Func<TestCallbackContext, Task>? callback = null) where T : IResource 472TestResourceStatus status) where T : IResource 483TestNestedDto config) where T : IResource 494Func<TestResourceContext, Task<bool>> validator) where T : IResource 506IResourceBuilder<IResource> dependency) where T : IResource 555IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 566IReadOnlyList<string> endpoints) where T : IResource 601Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Java (1)
AtsJavaCodeGenerator.cs (1)
543typeof(IResource).IsAssignableFrom(typeInfo.ClrType);
Aspire.Hosting.CodeGeneration.Java.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
71bool enabled = true) where T : IResource 84double multiplier = 1.5) where T : IResource 375TestConfigDto config) where T : IResource 427DateTime createdAt) where T : IResource 438DateTimeOffset modifiedAt) where T : IResource 449Guid correlationId) where T : IResource 460Func<TestCallbackContext, Task>? callback = null) where T : IResource 472TestResourceStatus status) where T : IResource 483TestNestedDto config) where T : IResource 494Func<TestResourceContext, Task<bool>> validator) where T : IResource 506IResourceBuilder<IResource> dependency) where T : IResource 555IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 566IReadOnlyList<string> endpoints) where T : IResource 601Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Python (1)
AtsPythonCodeGenerator.cs (1)
451typeof(IResource).IsAssignableFrom(typeInfo.ClrType);
Aspire.Hosting.CodeGeneration.Python.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
71bool enabled = true) where T : IResource 84double multiplier = 1.5) where T : IResource 375TestConfigDto config) where T : IResource 427DateTime createdAt) where T : IResource 438DateTimeOffset modifiedAt) where T : IResource 449Guid correlationId) where T : IResource 460Func<TestCallbackContext, Task>? callback = null) where T : IResource 472TestResourceStatus status) where T : IResource 483TestNestedDto config) where T : IResource 494Func<TestResourceContext, Task<bool>> validator) where T : IResource 506IResourceBuilder<IResource> dependency) where T : IResource 555IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 566IReadOnlyList<string> endpoints) where T : IResource 601Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Rust (1)
AtsRustCodeGenerator.cs (1)
610typeof(IResource).IsAssignableFrom(typeInfo.ClrType);
Aspire.Hosting.CodeGeneration.Rust.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
71bool enabled = true) where T : IResource 84double multiplier = 1.5) where T : IResource 375TestConfigDto config) where T : IResource 427DateTime createdAt) where T : IResource 438DateTimeOffset modifiedAt) where T : IResource 449Guid correlationId) where T : IResource 460Func<TestCallbackContext, Task>? callback = null) where T : IResource 472TestResourceStatus status) where T : IResource 483TestNestedDto config) where T : IResource 494Func<TestResourceContext, Task<bool>> validator) where T : IResource 506IResourceBuilder<IResource> dependency) where T : IResource 555IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 566IReadOnlyList<string> endpoints) where T : IResource 601Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.TypeScript.Tests (15)
TestTypes\TestExtensions.cs (15)
71bool enabled = true) where T : IResource 84double multiplier = 1.5) where T : IResource 375TestConfigDto config) where T : IResource 427DateTime createdAt) where T : IResource 438DateTimeOffset modifiedAt) where T : IResource 449Guid correlationId) where T : IResource 460Func<TestCallbackContext, Task>? callback = null) where T : IResource 472TestResourceStatus status) where T : IResource 483TestNestedDto config) where T : IResource 494Func<TestResourceContext, Task<bool>> validator) where T : IResource 506IResourceBuilder<IResource> dependency) where T : IResource 555IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 566IReadOnlyList<string> endpoints) where T : IResource 601Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.Containers.Tests (13)
ContainerResourceBuilderTests.cs (1)
218where T: IResource
ContainerResourceTests.cs (10)
24var containerResource = Assert.Single(containerResources); 43var containerResource = Assert.Single(containerResources); 62var containerResource = Assert.Single(containerResources); 82var containerResource = Assert.Single(containerResources); 180var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 214var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 242var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 261var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 310var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 357var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources());
WithDockerfileTests.cs (2)
930var resource = Assert.Single(containerResources); 970var resource1 = Assert.Single(containerResources1);
Aspire.Hosting.DevTunnels (6)
DevTunnelResourceBuilderExtensions.cs (2)
362public static EndpointReference GetEndpoint(this IResourceBuilder<DevTunnelResource> tunnelBuilder, IResource resource, string endpointName) 402private static EndpointReference CreateEndpointReferenceWithError(DevTunnelResource tunnelResource, IResource targetResource, string endpointName)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Docker (27)
CapturedEnvironmentVariable.cs (1)
41public IResource? Resource { get; set; }
DockerComposeEnvironmentContext.cs (1)
12public async Task<DockerComposeServiceResource> CreateDockerComposeServiceResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
DockerComposeEnvironmentResource.cs (8)
52internal Dictionary<IResource, DockerComposeServiceResource> ResourceMapping { get; } = new(new ResourceNameComparer()); 78foreach (var resource in resources) 80var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 144foreach (var resource in resources) 146var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 169foreach (var computeResource in context.Model.GetBuildResources()) 179foreach (var pushResource in context.Model.GetBuildAndPushResources()) 365internal string AddEnvironmentVariable(string name, string? description = null, string? defaultValue = null, object? source = null, IResource? resource = null)
DockerComposeInfrastructure.cs (3)
53foreach (var r in @event.Model.GetComputeResources()) 102foreach (var r in appModel.GetComputeResources()) 111private static void ConfigureOtlp(IResource resource, EndpointReference otlpEndpoint)
DockerComposePublishingContext.cs (3)
77IEnumerable<IResource> resources = environment.Dashboard?.Resource is IResource r 81foreach (var resource in resources)
DockerComposeServiceExtensions.cs (2)
106var resourceInstance = dockerComposeService.TargetResource; 120var resourceInstance = dockerComposeService.TargetResource;
DockerComposeServiceResource.cs (5)
25private readonly IResource _targetResource; 34public DockerComposeServiceResource(string name, IResource resource, DockerComposeEnvironmentResource composeEnvironmentResource) : base(name) 76IResource Resource, 87internal IResource TargetResource => _targetResource; 134private bool TryGetContainerImageName(IResource resourceInstance, out string? containerImageName)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Docker.Tests (13)
DockerComposePublisherTests.cs (3)
930public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 936public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 942public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
DockerComposeTests.cs (10)
235public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 241public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 247public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 683public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 686public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 689public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 830var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 836var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 842var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 848var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s");
Aspire.Hosting.JavaScript.Tests (4)
IntegrationTests.cs (3)
40foreach (var installer in npmInstallers.Cast<IResource>()) 53var waitedResource = waitAnnotations.First().Resource;
PackageInstallationTests.cs (1)
67var nodeResource = Assert.Single(appModel.Resources, r => r.Name == "test-app");
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
175var kafkaUiResource = Assert.Single(builder.Resources, r => r.Name == expectedContainerName);
Aspire.Hosting.Keycloak.Tests (2)
KeycloakPublicApiTests.cs (2)
163var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal)); 190var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal));
Aspire.Hosting.Kubernetes (20)
Extensions\ResourceExtensions.cs (7)
11internal static Deployment ToDeployment(this IResource resource, KubernetesResource context) 40internal static StatefulSet ToStatefulSet(this IResource resource, KubernetesResource context) 60internal static Secret? ToSecret(this IResource resource, KubernetesResource context) 92internal static ConfigMap? ToConfigMap(this IResource resource, KubernetesResource context) 122internal static Service? ToService(this IResource resource, KubernetesResource context) 172private static PodTemplateSpecV1 ToPodTemplateSpec(this IResource resource, KubernetesResource context) 239private static ContainerV1 ToContainerV1(this IResource resource, KubernetesResource context)
KubernetesEnvironmentContext.cs (2)
11private readonly Dictionary<IResource, KubernetesResource> _kubernetesComponents = []; 15public async Task<KubernetesResource> CreateKubernetesResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
KubernetesInfrastructure.cs (2)
39foreach (var r in @event.Model.GetComputeResources()) 62foreach (var r in appModel.GetComputeResources())
KubernetesPublishingContext.cs (4)
69foreach (var resource in model.Resources) 108private async Task AppendResourceContextToHelmValuesAsync(IResource resource, KubernetesResource resourceContext) 116IResource resource, 155private async Task WriteKubernetesTemplatesForResource(IResource resource, IEnumerable<BaseKubernetesResource> templatedItems)
KubernetesResource.cs (5)
15public partial class KubernetesResource(string name, IResource resource, KubernetesEnvironmentResource kubernetesEnvironmentResource) : Resource(name), IResourceWithParent<KubernetesEnvironmentResource> 61internal IResource TargetResource => resource; 134internal string GetContainerImageName(IResource resourceInstance) 503private static HelmValue AllocateParameter(ParameterResource parameter, IResource resource) 522private static HelmValue ResolveUnknownValue(IManifestExpressionProvider parameter, IResource resource)
Aspire.Hosting.Kubernetes.Tests (4)
KubernetesEnvironmentResourceTests.cs (4)
150var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 156var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 162var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 168var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker");
Aspire.Hosting.Maui (5)
Lifecycle\UnsupportedPlatformEventSubscriber.cs (1)
28foreach (var resource in @event.Model.Resources)
Utilities\MauiAndroidEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Utilities\MauiEnvironmentHelper.cs (2)
35IResource resource, 223IResource resource,
Utilities\MauiiOSEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Aspire.Hosting.Maui.Tests (8)
MauiPlatformExtensionsTests.cs (8)
152var resource = platform.Resource; 470IResource resource; 537IResource resource; 722public Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> AddPlatformWithDefaultName { get; } 723public Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> AddPlatformWithCustomName { get; } 724public Action<IResourceBuilder<IResource>> ApplyWithOtlpDevTunnel { get; } 733Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> addDefault, 734Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> addCustom,
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
27var containerResource = Assert.Single(appModel.GetContainerResources()); 57var containerResource = Assert.Single(appModel.GetContainerResources());
Aspire.Hosting.MySql (1)
MySqlBuilderExtensions.cs (1)
102/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (4)
85var containerResource = Assert.Single(appModel.GetContainerResources()); 242var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin")); 248var container = builder.Resources.Single(r => r.Name == "phpmyadmin"); 274var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin"));
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
44var containerResource = Assert.Single(appModel.GetContainerResources()); 83var containerResource = Assert.Single(appModel.GetContainerResources()); 165var containerResource = Assert.Single(containerResources);
Aspire.Hosting.PostgreSQL (2)
PostgresBuilderExtensions.cs (2)
37/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 132/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.PostgreSQL.Tests (7)
AddPostgresTests.cs (7)
54var containerResource = Assert.Single(appModel.GetContainerResources()); 108var containerResource = Assert.Single(appModel.GetContainerResources()); 201var containerResource = Assert.Single(containerResources); 381var container = builder.Resources.Single(r => r.Name == "pgadmin"); 435var container = builder.Resources.Single(r => r.Name == "pgadmin"); 469var pgadmin = builder.Resources.Single(r => r.Name.Equals("pgadmin")); 534var pgweb = builder.Resources.Single(r => r.Name.Equals("pgweb"));
Aspire.Hosting.Qdrant.Tests (4)
AddQdrantTests.cs (3)
47var containerResource = Assert.Single(appModel.GetContainerResources()); 86var containerResource = Assert.Single(appModel.GetContainerResources()); 119var containerResource = Assert.Single(appModel.GetContainerResources());
QdrantFunctionalTests.cs (1)
232var qdrantResource = builder.Resources.Single(r => r.Name.Equals("qdrant"));
Aspire.Hosting.Redis (2)
RedisBuilderExtensions.cs (2)
32/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 55/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Redis.Tests (4)
AddRedisTests.cs (4)
289var redisinsight = builder.Resources.Single(r => r.Name.Equals("redisinsight")); 517var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 543var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 564var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander"));
Aspire.Hosting.SqlServer (1)
SqlServerBuilderExtensions.cs (1)
105/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Testing (10)
DistributedApplicationHostingTestingExtensions.cs (4)
48var resource = GetResource(app, resourceName); 92static IResource GetResource(DistributedApplication app, string resourceName) 98var resource = resources.SingleOrDefault(r => string.Equals(r.Name, resourceName, StringComparison.OrdinalIgnoreCase)); 110var resource = GetResource(app, resourceName);
DistributedApplicationTestingBuilder.cs (6)
251public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => innerBuilder.AddResource(resource); 261public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => innerBuilder.CreateResourceBuilder(resource); 405public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => _innerBuilder.AddResource(resource); 419public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => _innerBuilder.CreateResourceBuilder(resource); 502new IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).AddResource(resource); 505new IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).CreateResourceBuilder(resource);
Aspire.Hosting.Testing.Tests (3)
TestingBuilderTests.cs (1)
106foreach (var resource in appModel.GetContainerResources())
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
tests\Shared\ConsoleLogging\ConsoleLoggingTestHelpers.cs (1)
8public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
Aspire.Hosting.Tests (72)
ApplicationModel\Docker\DockerfileBuilderCallbackContextTests.cs (1)
134Assert.IsAssignableFrom<IResource>(context.Resource);
Dashboard\DashboardLifecycleHookTests.cs (6)
90var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 238var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 318var dashboardResource = Assert.Single(model.Resources); 406var dashboardResource = Assert.Single(model.Resources); 478var dashboardResource = Assert.Single(model.Resources); 548var dashboardResource = Assert.Single(model.Resources);
Dashboard\DashboardResourceTests.cs (10)
109var dashboard = Assert.Single(model.Resources); 221var dashboard = Assert.Single(model.Resources); 296var dashboard = Assert.Single(model.Resources); 335var dashboard = Assert.Single(model.Resources); 371var dashboard = Assert.Single(model.Resources); 410var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 414var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 455var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 660var dashboard = Assert.Single(model.Resources); 692static void SetDashboardAllocatedEndpoints(IResource dashboard, int otlpGrpcPort, int otlpHttpPort, int httpPort, int mcpPort, int httpsPort)
Dcp\DcpExecutorTests.cs (3)
2277private static void HasKnownCommandAnnotations(IResource resource) 2427private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 2429public IResource Parent => parent;
DistributedApplicationBuilderTests.cs (1)
64var resource = Assert.Single(appModel.Resources);
DistributedApplicationTests.cs (2)
597foreach (var item in appModel.Resources) 1208var aspireDashboard = model.Resources.Single(r => r.Name == KnownResourceNames.AspireDashboard);
Eventing\DistributedApplicationBuilderEventingTests.cs (2)
272var resourceStopped = default(IResource);
MockImageBuilder.cs (5)
18public List<IResource> BuildImageResources { get; } = []; 20public List<IResource> PushImageCalls { get; } = []; 22public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 29public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 36public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Orchestrator\ApplicationOrchestratorTests.cs (3)
527private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 529public IResource Parent => parent; 583public IResource Parent { get; } = parent;
Orchestrator\ParameterProcessorTests.cs (1)
83var updates = new List<(IResource Resource, CustomResourceSnapshot Snapshot)>();
Orchestrator\RelationshipEvaluatorTests.cs (2)
138private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 140public IResource Parent => parent;
Pipelines\DistributedApplicationPipelineTests.cs (5)
954IResource? capturedResource = null; 1536IResource? targetResource = null; 1565var resource2Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource2"); 1608var resource1Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource1"); 1678IResource? capturedResource = null;
ProjectResourceTests.cs (1)
878var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
Publishing\FakeContainerRuntime.cs (2)
25public List<IResource> PushImageCalls { get; } = []; 62public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\ResourceContainerImageManagerTests.cs (1)
1057IResource? capturedResource = null;
RequiredCommandAnnotationTests.cs (15)
153var resource = appModel.Resources.Single(r => r.Name == "test"); 169var resource = appModel.Resources.Single(r => r.Name == "test"); 187var resource = appModel.Resources.Single(r => r.Name == "test"); 212var resource = appModel.Resources.Single(r => r.Name == "test"); 239var resource = appModel.Resources.Single(r => r.Name == "test"); 263var resource = appModel.Resources.Single(r => r.Name == "test"); 284var resource = appModel.Resources.Single(r => r.Name == "test"); 304var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 305var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 338var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 339var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 363var resource = appModel.Resources.Single(r => r.Name == "test"); 395var resource = appModel.Resources.Single(r => r.Name == "test"); 420var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 421var resource2 = appModel.Resources.Single(r => r.Name == "test2");
ResourceNotificationTests.cs (1)
54IResource resource = resourceType.Name switch
tests\Shared\ConsoleLogging\ConsoleLoggingTestHelpers.cs (1)
8public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
Utils\ArgumentEvaluator.cs (1)
11public static async ValueTask<List<string>> GetArgumentListAsync(IResource resource, IServiceProvider? serviceProvider = null)
Utils\EnvironmentVariableEvaluator.cs (1)
12IResource resource,
Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
Utils\ManifestUtils.cs (4)
13public static async Task<JsonNode> GetManifest(IResource resource, string? manifestDirectory = null) 20public static async Task<JsonNode?> GetManifestOrNull(IResource resource, string? manifestDirectory = null) 45public static async Task<JsonNode[]> GetManifests(IResource[] resources) 58foreach (var r in resources)
WithEnvironmentTests.cs (2)
487private readonly IResource _referencedResource; 489public TestValueWithReferences(string value, IResource referencedResource)
WithHttpCommandTests.cs (1)
527private static async Task MoveResourceToRunningStateAsync(DistributedApplication app, IResource resource, string commandName = "mycommand")
Aspire.Hosting.Yarp (1)
YarpResourceExtensions.cs (1)
253private static string GetYarpImageName(IResource resource)
Aspire.Playground.Tests (3)
Infrastructure\DistributedApplicationExtensions.cs (2)
72var resource = resourceVolume.Resource; 144static bool ShouldAssertErrorsForResource(IResource resource)
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
Pipelines.Library (1)
DistributedApplicationPipelineExtensions.cs (1)
30foreach (var resource in context.Model.GetComputeResources())
Stress.AppHost (7)
InteractionCommands.cs (1)
12public static IResourceBuilder<T> AddInteractionCommands<T>(this IResourceBuilder<T> resource) where T : IResource
Program.cs (3)
19IResource parent = rb.Resource; 143IResourceBuilder<IResource>? previousResourceBuilder = null; 177foreach (var r in resources)
TestResource.cs (3)
31public static IResourceBuilder<TestNestedResource> AddNestedResource(this IDistributedApplicationBuilder builder, string name, IResource parent) 114sealed class TestNestedResource(string name, IResource parent) : Resource(name), IResourceWithParent 116public IResource Parent { get; } = parent;