46 interfaces inheriting from IResource
Aspire.Hosting (14)
ApplicationModel\IComputeEnvironmentResource.cs (1)
12public 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, IExpressionValue, IValueWithReferences
ApplicationModel\IResourceWithContainerFiles.cs (1)
15public interface IResourceWithContainerFiles : IResource
ApplicationModel\IResourceWithCustomWithReference.cs (1)
15public interface IResourceWithCustomWithReference<TSelf> : 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 (6)
IAzureDelegatedSubnetResource.cs (1)
13public interface IAzureDelegatedSubnetResource : IResource
IAzureKeyVaultResource.cs (1)
12public interface IAzureKeyVaultResource : IResource, IAzureResource
IAzureNspAssociationTarget.cs (1)
18public interface IAzureNspAssociationTarget : IResource
IAzurePrivateEndpointTarget.cs (1)
13public interface IAzurePrivateEndpointTarget : IResource
IAzureResource.cs (1)
12public interface IAzureResource : IResource
IResourceWithAzureFunctionsConfig.cs (1)
11public interface IResourceWithAzureFunctionsConfig : IResource
Aspire.Hosting.CodeGeneration.Go.Tests (5)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestPromiseCollisionResources.cs (4)
11public interface ITestPromiseCollisionResource : IResource 29public interface ITestPromiseCollisionResourcePromise : IResource 47public interface ITestMutablePromiseCollisionResource : IResource 59public interface ITestMutablePromiseCollisionResourcePromise : IResource
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Java.Tests (5)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestPromiseCollisionResources.cs (4)
11public interface ITestPromiseCollisionResource : IResource 29public interface ITestPromiseCollisionResourcePromise : IResource 47public interface ITestMutablePromiseCollisionResource : IResource 59public interface ITestMutablePromiseCollisionResourcePromise : IResource
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Python.Tests (5)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestPromiseCollisionResources.cs (4)
11public interface ITestPromiseCollisionResource : IResource 29public interface ITestPromiseCollisionResourcePromise : IResource 47public interface ITestMutablePromiseCollisionResource : IResource 59public interface ITestMutablePromiseCollisionResourcePromise : IResource
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Rust.Tests (5)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestPromiseCollisionResources.cs (4)
11public interface ITestPromiseCollisionResource : IResource 29public interface ITestPromiseCollisionResourcePromise : IResource 47public interface ITestMutablePromiseCollisionResource : IResource 59public interface ITestMutablePromiseCollisionResourcePromise : IResource
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.TypeScript.Tests (6)
TestTypes\TestMarkerResource.cs (1)
20public interface ITestMarkerResource : IResource
TestTypes\TestPromiseCollisionResources.cs (4)
11public interface ITestPromiseCollisionResource : IResource 29public interface ITestPromiseCollisionResourcePromise : IResource 47public interface ITestMutablePromiseCollisionResource : IResource 59public interface ITestMutablePromiseCollisionResourcePromise : IResource
TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : 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)
431private sealed class TestResource : IResource
DistributedApplicationModelExtensionsTests.cs (1)
71private sealed class CustomResource : IResource
Eventing\DistributedApplicationBuilderEventingTests.cs (1)
531private sealed class TestResource(string name) : IResource
Utils\VolumeNameGeneratorTests.cs (1)
47private sealed class TestResource(string name) : IResource
1554 references to IResource
Aspire.Hosting (637)
ApplicationModel\ArgumentsExecutionConfigurationGatherer.cs (2)
15public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default) 49private static async ValueTask GatherLaunchToolArgumentsAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
ApplicationModel\BeforeResourceStartedEvent.cs (2)
17public class BeforeResourceStartedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 20public IResource Resource { get; } = resource;
ApplicationModel\CertificateTrustConfigurationCallbackAnnotation.cs (1)
34public required IResource Resource { get; init; }
ApplicationModel\CertificateTrustExecutionConfigurationGatherer.cs (1)
34public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\CommandLineArgsCallbackAnnotation.cs (3)
98private readonly IResource? _resource; 106public CommandLineArgsCallbackContext(IList<object> args, IResource resource, CancellationToken cancellationToken = default) 149public IResource Resource => _resource ?? throw new InvalidOperationException($"{nameof(Resource)} is not set. This callback context is not associated with a resource.");
ApplicationModel\CommandsConfigurationExtensions.cs (3)
18internal static void AddLifeCycleCommands(this IResource resource) 153private static void AddRebuildCommand(IResource projectResource) 202private static async Task<ExecuteCommandResult> ExecuteRebuildAsync(ExecuteCommandContext context, IResource projectResource)
ApplicationModel\ConnectionStringAvailableEvent.cs (3)
11/// <param name="resource">The <see cref="IResource"/> for the event.</param> 15public class ConnectionStringAvailableEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 18public IResource Resource => resource;
ApplicationModel\ContainerBuildOptionsCallbackAnnotation.cs (2)
52IResource resource, 68public IResource Resource { get; }
ApplicationModel\ContainerFilesDestinationAnnotation.cs (1)
20public required IResource Source { get; init; }
ApplicationModel\ContainerFileSystemCallbackAnnotation.cs (1)
298public required IResource Model { get; init; }
ApplicationModel\ContainerImagePushOptionsCallbackContext.cs (1)
28public 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)
646public static ImmutableArray<RelationshipSnapshot> BuildRelationships(IResource resource)
ApplicationModel\CustomResourceSnapshotExtensions.cs (2)
21/// This method is intended for use with <see cref="ResourceNotificationService.PublishUpdateAsync(IResource, Func{CustomResourceSnapshot, CustomResourceSnapshot})"/> 22/// and <see cref="ResourceNotificationService.PublishUpdateAsync(IResource, string, Func{CustomResourceSnapshot, CustomResourceSnapshot})"/>.
ApplicationModel\DebugSupportExtensions.cs (4)
45public static bool SupportsDebugging(this IResource resource, IConfiguration configuration, [NotNullWhen(true)] out SupportsDebuggingAnnotation? supportsDebuggingAnnotation) 88public static bool HasLaunchToolArgsOwnedBy(this IResource resource, SupportsDebuggingAnnotation supportsDebuggingAnnotation) 127this IResource resource, 166this IResource resource,
ApplicationModel\DeploymentTargetAnnotation.cs (2)
9public sealed class DeploymentTargetAnnotation(IResource target) : IResourceAnnotation 14public IResource DeploymentTarget { get; set; } = target;
ApplicationModel\DistributedApplicationModel.cs (1)
22public 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> 18public static IEnumerable<IResource> GetComputeResources(this DistributedApplicationModel model) 20foreach (var r in model.Resources) 46/// <returns>An enumerable of build <see cref="IResource"/> in the model.</returns> 48public static IEnumerable<IResource> GetBuildResources(this DistributedApplicationModel model) 50foreach (var r in model.Resources) 64/// <returns>An enumerable of build and push <see cref="IResource"/> in the model.</returns> 66public static IEnumerable<IResource> GetBuildAndPushResources(this DistributedApplicationModel model) 68foreach (var r in model.Resources)
ApplicationModel\Docker\ContainerFilesExtensions.cs (6)
24public static DockerfileBuilder AddContainerFilesStages(this DockerfileBuilder builder, IResource resource, ILogger? logger) 33var source = containerFileDestination.Source; 82public static DockerfileStage AddContainerFiles(this DockerfileStage stage, IResource resource, string rootDestinationPath, ILogger? logger) 92var source = containerFileDestination.Source; 123private static string GetSourceImageArgName(IResource source) => $"{source.Name.Replace("-", "_").ToUpperInvariant()}_IMAGENAME"; 126private static string GetSourceStageName(IResource source) => $"{source.Name.Replace("-", "_")}_stage";
ApplicationModel\DockerfileBuilderCallbackContext.cs (2)
23public DockerfileBuilderCallbackContext(IResource resource, DockerfileBuilder builder, IServiceProvider services, CancellationToken cancellationToken) 34public IResource Resource { get; }
ApplicationModel\DockerfileFactoryContext.cs (1)
39public 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) 69public 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\ExecutableLaunchRecipe.cs (4)
141IResource resource, 152public IResource Resource { get; } = resource ?? throw new ArgumentNullException(nameof(resource)); 779IResource resource, 831private static bool IsExecutableAnnotatedDotnetProject(IResource resource) =>
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)
38public 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\HttpsEndpointUpdateCallbackContext.cs (2)
22/// Gets the <see cref="IResource"/> that is being configured for HTTPS. 24public required IResource Resource { get; init; }
ApplicationModel\IExecutionConfigurationGatherer.cs (1)
23ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default);
ApplicationModel\InitializeResourceEvent.cs (2)
23IResource resource, 30public 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 (3)
11public interface IResourceCollection : IList<IResource> 22bool TryGetByName(string name, [NotNullWhen(true)] out IResource? resource) 24foreach (var item in this)
ApplicationModel\IResourceWithCustomWithReference.cs (2)
16where TSelf : IResource, IResourceWithCustomWithReference<TSelf> 30IResourceBuilder<IResource> source,
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\LaunchConfigurationCallbackContext.cs (2)
21IResource resource, 43public IResource Resource { get; }
ApplicationModel\PersistenceAnnotation.cs (1)
51public IResource? SourceResource { get; set; }
ApplicationModel\ProjectLaunchConfigurationFactory.cs (2)
13public static ProjectLaunchConfiguration Create(IResource resource, string mode) 25public static ProjectLaunchConfiguration Create(IResource resource, IProjectMetadata projectMetadata, string mode)
ApplicationModel\ProjectLaunchDefaultsAnnotation.cs (2)
54internal void ValidateProjectMetadata(IResource resource, IProjectMetadata projectMetadata) 73public static bool ShouldInjectEndpointEnvironment(this IResource resource, EndpointReference e)
ApplicationModel\ProjectRebuilderResource.cs (3)
14internal sealed class ProjectRebuilderResource : ExecutableResource, IResourceWithParent<IResource> 22public ProjectRebuilderResource(string name, IResource parent, string projectPath) 32public IResource Parent { get; }
ApplicationModel\ProjectResourceExtensions.cs (3)
44return GetProjectMetadata((IResource)projectResource); 47internal static IProjectMetadata GetProjectMetadata(this IResource projectResource) 57internal static bool TryGetProjectMetadata(this IResource projectResource, [NotNullWhen(true)] out IProjectMetadata? projectMetadata)
ApplicationModel\ReferenceExpression.cs (5)
414where T : IResource, IValueProvider, IManifestExpressionProvider 426where T : IResource, IValueProvider, IManifestExpressionProvider 596var unwrapped = valueProvider is IResourceBuilder<IResource> rb ? rb.Resource : valueProvider; 702where T : IResource, IValueProvider, IManifestExpressionProvider 714where T : IResource, IValueProvider, IManifestExpressionProvider
ApplicationModel\RequiredCommandValidator.cs (1)
50IResource 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 (19)
14private readonly List<IResource> _resources = []; 15private readonly Dictionary<string, IResource> _resourcesByName = new(StringComparers.ResourceName); 19public ResourceCollection(IEnumerable<IResource> resources) 21foreach (var resource in resources) 32public IResource this[int index] 37var old = _resources[index]; 41_resourcesByName.TryGetValue(value.Name, out var existing)) 55public void Add(IResource item) 71public bool Contains(IResource item) => _resources.Contains(item); 72public void CopyTo(IResource[] array, int arrayIndex) => _resources.CopyTo(array, arrayIndex); 73public IEnumerator<IResource> GetEnumerator() => _resources.GetEnumerator(); 74public int IndexOf(IResource item) => _resources.IndexOf(item); 76public void Insert(int index, IResource item) 86public bool Remove(IResource item) 99var item = _resources[index]; 104public bool TryGetByName(string name, [NotNullWhen(true)] out IResource? resource) 118private static void ThrowDuplicateResource(IResource newResource, IResource existingResource) 132public required IResource Resource { get; init; }
ApplicationModel\ResourceCommandService.cs (6)
115public async Task<ExecuteCommandResult> ExecuteCommandAsync(IResource resource, string commandName, CancellationToken cancellationToken = default) 130public async Task<ExecuteCommandResult> ExecuteCommandAsync(IResource resource, string commandName, InteractionInputCollection arguments, CancellationToken cancellationToken = default) 230private static (InteractionInputCollection Arguments, string? ErrorMessage) CreateCommandArguments(IResource resource, string commandName, IReadOnlyDictionary<string, string?>? argumentValues) 313internal async Task<ExecuteCommandResult> ExecuteCommandAsync(IResource resource, string commandName, IReadOnlyDictionary<string, string?>? argumentValues, CancellationToken cancellationToken) 326internal async Task<ExecuteCommandResult> ExecuteCommandCoreAsync(string resourceId, IResource resource, string commandName, InteractionInputCollection arguments, bool argumentsProvided, bool nonInteractive, CancellationToken cancellationToken) 529private static ResourceCommandAnnotation? ResolveCommandAnnotation(IResource resource, ref string commandName, ILogger? logger = null)
ApplicationModel\ResourceEndpointsAllocatedEvent.cs (2)
15public class ResourceEndpointsAllocatedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 18public IResource Resource { get; } = resource;
ApplicationModel\ResourceExtensions.cs (89)
18/// Provides extension methods for the <see cref="IResource"/> interface. 30public static bool TryGetLastAnnotation<T>(this IResource resource, [NotNullWhen(true)] out T? annotation) where T : IResourceAnnotation 54public static bool TryGetAnnotationsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 77public static bool HasAnnotationOfType<T>(this IResource resource) where T : IResourceAnnotation 90public static bool TryGetAnnotationsIncludingAncestorsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 128public static bool HasAnnotationIncludingAncestorsOfType<T>(this IResource resource) where T : IResourceAnnotation 162public static bool TryGetEnvironmentVariables(this IResource resource, [NotNullWhen(true)] out IEnumerable<EnvironmentCallbackAnnotation>? environmentVariables) 266this IResource resource, 299IResource resource, 351this IResource resource, 391this IResource resource, 414this IResource resource, 448this IResource resource, 484this IResource resource, 509this IResource resource, 547where T : IResource, IComputeResource 567where T : IResource, IComputeResource 575internal static NetworkIdentifier GetDefaultResourceNetwork(this IResource resource) 580internal static IEnumerable<NetworkIdentifier> GetSupportedNetworks(this IResource resource) 586this IResource resource, 597(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await resource.GetValue(executionContext, key, provider, logger, cancellationToken).ConfigureAwait(false), 599(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false), 610public static bool IsExcludedFromPublish(this IResource resource) => 614this IResource resource, 657private static async Task<ResolvedValue?> GetValue(this IResource resource, DistributedApplicationExecutionContext executionContext, string? key, IValueProvider valueProvider, ILogger logger, CancellationToken cancellationToken) 663if (valueProvider is IResource providerResource) 721public static bool TryGetContainerMounts(this IResource resource, [NotNullWhen(true)] out IEnumerable<ContainerMountAnnotation>? volumeMounts) 733public static bool TryGetEndpoints(this IResource resource, [NotNullWhen(true)] out IEnumerable<EndpointAnnotation>? endpoints) 745public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls) 754/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 771/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 838public static IReadOnlyList<ResolvedEndpoint> ResolveEndpoints(this IResource resource, IPortAllocator? portAllocator = null) 925public static bool TryGetContainerImageName(this IResource resource, [NotNullWhen(true)] out string? imageName) 938public static bool TryGetContainerImageName(this IResource resource, bool useBuiltImage, [NotNullWhen(true)] out string? imageName) 980public static int GetReplicaCount(this IResource resource) 1002public static bool RequiresImageBuild(this IResource resource) 1023public static bool RequiresImageBuildAndPush(this IResource resource) 1028internal static bool IsBuildOnlyContainer(this IResource resource) 1040public static IComputeEnvironmentResource? GetComputeEnvironment(this IResource resource) 1054public static DeploymentTargetAnnotation? GetDeploymentTargetAnnotation(this IResource resource, IComputeEnvironmentResource? targetComputeEnvironment = null) 1108internal static Lifetime GetLifetimeType(this IResource resource) 1113private static Lifetime GetLifetimeType(IResource resource, HashSet<IResource> visitedResources) 1152internal static bool HasPersistentLifetime(this IResource resource) 1157internal static string GetOtelServiceInstanceId(this IResource resource, DcpInstance instance) 1169internal static bool TryGetParentProcessLifetime(this IResource resource, out int parentProcessId, out DateTime parentProcessTimestamp) 1174private static bool TryGetParentProcessLifetime(IResource resource, HashSet<IResource> visitedResources, out int parentProcessId, out DateTime parentProcessTimestamp) 1213internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy) 1231internal static bool SupportsProxy(this IResource resource) 1241internal static IResource GetRootResource(this IResource resource) => 1252internal static string GetResolvedResourceName(this IResource resource) 1272internal static string GetResolvedDisplayResourceName(this IResource resource, string resourceId) 1283internal static bool TryGetInstances(this IResource resource, out ImmutableArray<DcpInstance> instances) 1300internal static string[] GetResolvedResourceNames(this IResource resource) 1320this IResource resource, 1360internal static IContainerRegistry GetContainerRegistry(this IResource resource) 1385var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 1407this IResource resource, 1450internal static ILogger GetLogger(this IResource resource, IServiceProvider serviceProvider) 1484public static Task<IReadOnlySet<IResource>> GetResourceDependenciesAsync( 1485this IResource resource, 1516public static Task<IReadOnlySet<IResource>> GetResourceDependenciesAsync( 1517this IResource resource, 1547internal static async Task<IReadOnlySet<IResource>> GetDependenciesAsync( 1548IEnumerable<IResource> resources, 1553var dependencies = new HashSet<IResource>(); 1554var newDependencies = new HashSet<IResource>(); 1555var toProcess = new Queue<IResource>(); 1558foreach (var resource in resources) 1567foreach (var nd in newDependencies) 1574var dep = toProcess.Dequeue(); 1579foreach (var newDep in newDependencies) 1591foreach (var resource in resources) 1609IResource resource, 1610HashSet<IResource> dependencies, 1611HashSet<IResource> newDependencies, 1634IResource resource, 1740private static void CollectAnnotationDependencies(IResource resource, HashSet<IResource> dependencies, HashSet<IResource> newDependencies) 1778HashSet<IResource> dependencies, 1779HashSet<IResource> newDependencies, 1794if (value is IResource resource) 1803if (value is IResourceBuilder<IResource> resourceBuilder) 1824HashSet<IResource> dependencies, 1825HashSet<IResource> newDependencies, 1861internal static string GetResourceType(this IResource resource) => resource switch
ApplicationModel\ResourceLoggerService.cs (5)
49public ILogger GetLogger(IResource resource) 145public IAsyncEnumerable<IReadOnlyList<LogLine>> GetAllAsync(IResource resource) 165public IAsyncEnumerable<IReadOnlyList<LogLine>> WatchAsync(IResource resource) 273/// <param name="resource">The <see cref="IResource"/>.</param> 274public void Complete(IResource resource)
ApplicationModel\ResourceNotificationService.cs (24)
142private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 298private async Task WaitUntilCompletionAsync(IResource resource, IResource dependency, int exitCode, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 372private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, 448private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 476public async Task WaitForDependenciesAsync(IResource resource, CancellationToken cancellationToken) 597private Task PublishWaitingForDependenciesAsync(IResource resource, IEnumerable<string> dependencyNames) 626private Task ClearWaitingForDependenciesAsync(IResource resource) 828public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 955IResource resource, 1042IResource resource, 1090private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState) 1170private static CustomResourceSnapshot UpdateIcons(IResource resource, CustomResourceSnapshot previousState) 1198private static CustomResourceSnapshot UpdateDashboardVisibility(IResource resource, CustomResourceSnapshot previousState) 1229public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 1238private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState) 1266private ResourceNotificationState GetResourceNotificationState(string resourceId, IResource resource) => 1388private sealed class ResourceNotificationState(IResource resource) 1393public IResource Resource { get; } = resource; 1442public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot) 1447public IResource Resource { get; } = resource;
ApplicationModel\ResourceReadyEvent.cs (2)
17public class ResourceReadyEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 22public 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)
18public class ResourceStoppedEvent(IResource resource, IServiceProvider services, ResourceEvent resourceEvent) : IDistributedApplicationResourceEvent 21public IResource Resource { get; } = resource;
ApplicationModel\ResourceUrlsCallbackContext.cs (2)
17public class ResourceUrlsCallbackContext(DistributedApplicationExecutionContext executionContext, IResource resource, List<ResourceUrlAnnotation>? urls = null, CancellationToken cancellationToken = default) 23public IResource Resource { get; } = resource;
ApplicationModel\TerminalHostResource.cs (3)
12internal sealed class TerminalHostResource : ExecutableResource, IResourceWithParent<IResource> 27public TerminalHostResource(string name, IResource parent, TerminalHostLayout layout) 40public IResource Parent { get; }
ApplicationModel\TerminalResourceSnapshotProperties.cs (2)
36IResource resource, 78private static int ResolveReplicaIndex(IResource resource, string resourceId)
ApplicationModel\WaitAnnotation.cs (2)
18public sealed class WaitAnnotation(IResource resource, WaitType waitType, int exitCode = 0) : IResourceAnnotation 23public IResource Resource { get; } = resource;
Ats\AtsTypeMappings.cs (1)
38[assembly: AspireExport(typeof(IResource))]
Ats\CoreExports.cs (1)
104public static string GetResourceName(this IResourceBuilder<IResource> resource)
Ats\DockerfileBuilderExports.cs (2)
176public static DockerfileBuilder AddContainerFilesStages(this DockerfileBuilder builder, IResource resource, ILogger? logger = null) 188public static DockerfileStage AddContainerFiles(this DockerfileStage stage, IResource resource, string rootDestinationPath, ILogger? logger = null)
Ats\EventingExports.cs (4)
73where T : IResource 89where T : IResource 121where T : IResource 153where T : IResource
Ats\ExecutionConfigurationExports.cs (1)
24public static IExecutionConfigurationBuilder CreateExecutionConfiguration(this IResource resource)
Ats\LoggingExports.cs (1)
105public static void CompleteLog(this ResourceLoggerService loggerService, IResourceBuilder<IResource> resource)
Ats\ModelExports.cs (2)
33public static IResource[] GetResources(this DistributedApplicationModel model) 47public static IResource? FindResourceByName(this DistributedApplicationModel model, string name)
Ats\NotificationExports.cs (2)
69IResourceBuilder<IResource> resource) 95IResourceBuilder<IResource> resource,
Ats\ResourceCommandExports.cs (2)
39[AspireUnion(typeof(string), typeof(IResource))] object resource, 51IResource resourceHandle => resourceCommandService.ExecuteCommandAsync(resourceHandle, commandName, arguments, cancellationToken),
Ats\UserSecretsExports.cs (1)
58where T : IResource
Backchannel\AuxiliaryBackchannelRpcTarget.cs (8)
431var resource = appModel.Resources.FirstOrDefault(r => string.Equals(r.Name, request.ResourceName, StringComparisons.ResourceName)); 587foreach (var resource in appModel.Resources) 779var matchingResource = appModel.Resources.SingleOrDefault(resource => string.Equals(resource.Name, requestedResourceName, StringComparisons.ResourceName)); 977foreach (var resource in appModel.Resources) 1044var resource = resourceEvent.Resource; 1330IReadOnlySet<IResource> dependencies; 1977foreach (var resource in appModel.Resources) 2002foreach (var resource in appModel.Resources)
BuiltInDistributedApplicationEventSubscriptionHandlers.cs (3)
22foreach (var container in beforeStartEvent.Model.GetContainerResources()) 58foreach (var resource in beforeStartEvent.Model.Resources) 97foreach (var resource in beforeStartEvent.Model.Resources)
ConnectionStringBuilderExtensions.cs (3)
60if (value is IResource resource) 70foreach (var innerRef in valueWithReferences.References.OfType<IResource>())
ContainerRegistryResourceBuilderExtensions.cs (3)
153foreach (var resource in beforeStartEvent.Model.Resources) 188where TDestination : IResource 189where TContainerRegistry : IResource, IContainerRegistry
ContainerResourceBuilderExtensions.cs (1)
1844public static IResourceBuilder<T> WithDockerfileBaseImage<T>(this IResourceBuilder<T> builder, string? buildImage = null, string? runtimeImage = null) where T : IResource
ContainerResourceExtensions.cs (3)
19public static IEnumerable<IResource> GetContainerResources(this DistributedApplicationModel model) 23foreach (var resource in model.Resources) 38public static bool IsContainer(this IResource resource)
CustomResourceExtensions.cs (1)
23where TResource : IResource
Dashboard\DashboardEventHandlers.cs (2)
344private void ConfigureAspireDashboardResource(IResource dashboardResource) 770private void AddDashboardOtlpEndpoint(IResource dashboardResource, string? endpointUrl, string endpointName, EndpointGenerationContext context, string? transport = null)
Dashboard\DashboardServiceData.cs (1)
43static 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)
71public IResource ModelResource { get; } 73public RenderedModelResource(IResource modelResource, TDcpResource dcpResource) : base(dcpResource) 96public ServiceWithModelResource(IResource modelResource, Service service, EndpointAnnotation sba) : base(modelResource, service) 104IResource ModelResource { get; }
Dcp\ContainerCreator.cs (13)
27internal static HostResourceWithEndpoints? Create(IResource resource) 141foreach (var container in modelContainerResources) 210private static void ApplyMonitorProcess(IResource resource, ContainerSpec spec) 219private void ValidateContainerTunnelContainerNameConflicts(IEnumerable<IResource> modelContainerResources) 226foreach (var container in modelContainerResources) 303var modelContainer = cr.ModelResource; 636internal async Task<IEnumerable<HostResourceWithEndpoints>> GetHostDependenciesAsync(IResource resource, CancellationToken cancellationToken) 653if (_model.Resources.TryGetByName(KnownResourceNames.AspireDashboard, out var dashboardResource) 903private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken) 929private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, DistributedApplicationExecutionContext executionContext, ILogger logger, CancellationToken cancellationToken) 1059private static List<VolumeMount> BuildContainerMounts(IResource container) 1080private void EnsureRequiredAnnotations(IResource resource) 1088public required IResource Resource { get; init; }
Dcp\DcpExecutor.cs (17)
213List<IResource> endpointAllocatedResources = []; 240foreach (var resource in endpointAllocatedResources.Distinct()) 374internal static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource 747private static bool GetEffectiveIsProxied(IResource resource, EndpointAnnotation endpoint, bool randomizePorts) 780private static bool TryGetEffectiveFixedPublicPort(IResource resource, EndpointAnnotation endpoint, bool randomizePorts, out int publicPort) 802private void EnsureProxylessEndpointPort(IResource resource, EndpointAnnotation endpoint) 837private static bool NeedsPublicPort(IResource resource, EndpointAnnotation endpoint) 846private int? TryGetPersistedProxylessEndpointPort(IResource resource, EndpointAnnotation endpoint) 869private static string GetPersistedProxylessEndpointPortKey(IResource resource, EndpointAnnotation endpoint) 876internal static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder) 910var groupKey = group.Key; 921IResource modelResource, 1077internal static DcpInstance GetDcpInstance(IResource resource, int instanceIndex) 1333private static void ForgetCachedCallbackResults(IResource resource) 1360private void ForgetConnectionStringAvailableEvent(IResource resource) 1368private async Task<bool> PublishEndpointsAllocatedEventAsync(IResource resource, CancellationToken ct) 1383private async Task PublishConnectionStringAvailableEventAsync(IResource resource, CancellationToken ct)
Dcp\DcpExecutorEvents.cs (4)
11internal record OnResourceStartingContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName); 12internal record OnConnectionStringAvailableContext(CancellationToken CancellationToken, IResource Resource); 14internal record OnResourceChangedContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string DcpResourceName, ResourceStatus Status, Func<CustomResourceSnapshot, CustomResourceSnapshot> UpdateSnapshot); 15internal record OnResourceFailedToStartContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName, string? ErrorMessage = null);
Dcp\DcpHost.cs (1)
662private static bool ResourceUsesTls(IResource resource)
Dcp\DcpModelUtilities.cs (7)
21internal static bool ShouldDeferCreateForExplicitStart(IResource modelResource, bool? start) 31internal static void ValidateEndpointPorts(IResource modelResource, EndpointAnnotation endpoint) 56var modelResource = appResource.ModelResource; 267internal static bool AreResourceEndpointsAllocated(IResource resource) 273IEnumerable<IResource> affectedResources, 277foreach (var res in affectedResources) 336private static bool TryGetEndpoint(IResource resource, string? endpointName, [NotNullWhen(true)] out EndpointAnnotation? endpoint)
Dcp\DcpNameGenerator.cs (8)
35public void EnsureDcpInstancesPopulated(IResource resource) 67private static void AddInstancesAnnotation(IResource resource, ImmutableArray<DcpInstance> instances) 72private static void ThrowIfPersistentExecutableHasReplicas(IResource resource) 85public (string Name, string Suffix) GetContainerName(IResource container) 96public (string Name, string Suffix) GetExecutableName(IResource project) 109public (string, bool) GetServiceName(IResource resource, EndpointAnnotation endpoint, NetworkIdentifier targetNetworkId) 157public static string GetObjectNameForResource(IResource resource, DcpOptions options, string suffix = "") 176private static string NetworkServiceKey(IResource resource, EndpointAnnotation endpoint, NetworkIdentifier targetNetworkId)
Dcp\DcpResourceState.cs (2)
10internal sealed class DcpResourceState(IDictionary<string, IResource> applicationModel, IEnumerable<IAppResource> appResources) 19public IDictionary<string, IResource> ApplicationModel { get; } = applicationModel;
Dcp\DcpResourceWatcher.cs (3)
294_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource)) 529private void AddDcpResourceObservedEvent(CustomResource resource, IResource appModelResource, string resourceKind, ResourceStatus status) 905_resourceState.ApplicationModel.TryGetValue(appModelResourceName, out var appModelResource))
Dcp\ExecutableCreator.cs (7)
118IResource resource, 252IResource resource, 264private static void ApplyExplicitStart(IResource resource, ExecutableSpec spec) 272private static void ApplyLifetime(IResource resource, ExecutableSpec spec) 291private static void ApplyTerminal(IResource resource, Executable executable, ILogger logger) 328private void EnsureRequiredAnnotations(IResource resource) 334private void AddRenderedResource(IResource resource, Executable executable)
Dcp\ExecutableLaunchPolicy.cs (2)
17public ExecutableLaunchDecision Decide(IResource resource) 80IResource resource,
Dcp\ResourceSnapshotBuilder.cs (5)
43_resourceState.ApplicationModel.TryGetValue(container.AppModelResourceName, out var appModelResource)) 100IResource? appModelResource = null; 137IResource? appModelResource = null; 225private static string? GetLaunchConfigurationType(IResource? resource) 288_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource) &&
Diagnostics\ProfilingTelemetry.cs (13)
385IResource appModelResource, 402public static ActivityScope StartResourceBeforeStartWait(IConfiguration? configuration, IResource resource) 409public static ActivityScope StartResourceCreate(IConfiguration? configuration, IResource resource, string resourceKind, int replicaCount) 419IResource resource, 429public static ActivityScope StartResourceStart(IConfiguration? configuration, IResource resource, string resourceKind, string resourceName, string resourceType) 467public static ActivityScope StartResourceStop(IConfiguration? configuration, IResource resource, string resourceKind, string resourceName) 475public static ActivityScope StartResourceWaitForDependencies(IConfiguration? configuration, IResource resource, int dependencyCount) 483public static ActivityScope StartResourceWaitForDependency(IConfiguration? configuration, IResource resource, IResource dependency, WaitType waitType, WaitBehavior? waitBehavior) 993public void SetDependencyWait(IResource resource, IResource dependency, WaitType waitType, WaitBehavior? waitBehavior) 1017public void SetResource(IResource resource) 1033public void SetResourceLifecycle(IResource resource, string resourceId, CustomResourceSnapshot snapshot)
DistributedApplication.cs (2)
815foreach (var resource in app._model.Resources) 831public required IResource Resource { get; init; }
DistributedApplicationBuilder.cs (4)
834foreach (var resource in Resources) 849public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource 860public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource 927private static void ValidateResourceName(IResource resource)
DistributedApplicationBuilderExtensions.cs (4)
63public static IResourceBuilder<T> CreateResourceBuilder<T>(this IDistributedApplicationBuilder builder, string name) where T : IResource 67var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase)); 95public static bool TryCreateResourceBuilder<T>(this IDistributedApplicationBuilder builder, string name, [NotNullWhen(true)] out IResourceBuilder<T>? resourceBuilder) where T : IResource 100var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase));
DistributedApplicationEventingExtensions.cs (5)
61where T : IResource 74where T : IResource 100where T : IResource 126where T : IResource 138where TResource : IResource
DistributedApplicationResourceBuilder.cs (1)
8internal sealed class DistributedApplicationResourceBuilder<T>(IDistributedApplicationBuilder applicationBuilder, T resource) : IResourceBuilder<T> where T : IResource
EmulatorResourceExtensions.cs (1)
19public static bool IsEmulator(this IResource resource)
Eventing\DistributedApplicationEventing.cs (1)
159public 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;
Health\ResourceHealthCheckService.cs (3)
82var resource = resourceEvent.Resource; 118var resource = state.LatestEvent.Resource; 255private void FireResourceReadyEvent(IResource resource, CancellationToken cancellationToken)
IDistributedApplicationBuilder.cs (4)
195/// constructs a resource derived from <see cref="IResource"/> and adds it to the application model using the <see cref="AddResource{T}(T)"/> 208IResourceBuilder<T> AddResource<T>(T resource) where T : IResource; 228/// Calling extension methods on the <see cref="IResourceBuilder{T}"/> typically results in modifications to the <see cref="IResource.Annotations"/> 264IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource;
Lifecycle\RequiredCommandValidationEventingSubscriber.cs (1)
33var resource = @event.Resource;
Orchestrator\ApplicationOrchestrator.cs (16)
25private readonly ILookup<IResource, IResource> _parentChildLookup; 208private async Task PublishResourceEndpointUrls(IResource resource, CancellationToken cancellationToken) 218private static IEnumerable<UrlSnapshot> GetResourceUrls(IResource resource) 285static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 303private async Task ProcessResourceUrlCallbacks(IResource resource, CancellationToken cancellationToken) 689private async Task SetChildResourceAsync(IResource resource, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp) 691foreach (var child in _parentChildLookup[resource].Where(c => c is IResourceWithParent)) 718foreach (var resource in _model.Resources) 722var parent = resource is IResourceWithParent hasParent 744private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource) 755private async Task PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken) 781private async Task PublishEventToHierarchy<TEvent>(Func<IResource, TEvent> createEvent, IResource resource, CancellationToken cancellationToken) 790foreach (var child in children.Where(c => c is IResourceWithParent)) 805private static bool ResourceHasOwnLifetime(IResource resource) =>
Orchestrator\ParameterProcessor.cs (1)
136foreach (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 (4)
23public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment) 42public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment, OtlpProtocol protocol) 54private static void RegisterOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment) 211if (!model.Resources.TryGetByName(KnownResourceNames.AspireDashboard, out var resource) || resource is not IResourceWithEndpoints dashboardResource)
Pipelines\DistributedApplicationPipeline.cs (6)
127foreach (var resource in context.Model.GetBuildResources()) 234foreach (var resource in context.Model.Resources) 282var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 427foreach (var resource in model.Resources) 745foreach (var resource in context.Model.Resources) 780foreach (var resource in pipelineContext.Model.Resources)
Pipelines\IPipelineOutputService.cs (2)
28string GetOutputDirectory(IResource resource); 41string GetTempDirectory(IResource resource);
Pipelines\PipelineConfigurationContext.cs (3)
49internal ILookup<IResource?, PipelineStep>? StepToResourceMap { get; init; } 82public IEnumerable<PipelineStep> GetSteps(IResource resource) 97public IEnumerable<PipelineStep> GetSteps(IResource resource, string tag)
Pipelines\PipelineOutputService.cs (2)
75public string GetOutputDirectory(IResource resource) 90public string GetTempDirectory(IResource resource)
Pipelines\PipelineStep.cs (1)
59public IResource? Resource { get; set; }
Pipelines\PipelineStepFactoryContext.cs (1)
25public required IResource Resource { get; init; }
Pipelines\PipelineStepFactoryExtensions.cs (7)
26Func<PipelineStepFactoryContext, PipelineStep> factory) where T : IResource 45Func<PipelineStepFactoryContext, Task<PipelineStep>> factory) where T : IResource 64Func<PipelineStepFactoryContext, IEnumerable<PipelineStep>> factory) where T : IResource 83Func<PipelineStepFactoryContext, Task<IEnumerable<PipelineStep>>> factory) where T : IResource 111string? description = null) where T : IResource 140Func<PipelineConfigurationContext, Task> callback) where T : IResource 159Action<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)
ProjectResourceBuilderExtensions.cs (2)
1025private static IConfiguration GetConfiguration(IResource projectResource) 1056where TProjectResource : class, IResource
Publishing\ContainerRuntimeBase.cs (1)
77public virtual async Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\IContainerRuntime.cs (1)
59Task PushImageAsync(IResource resource, CancellationToken cancellationToken);
Publishing\ManifestPublishingContext.cs (22)
43private readonly Dictionary<string, IResource> _referencedResources = []; 83foreach (var resource in model.Resources) 91foreach (var resource in model.Resources) 111internal async Task WriteResourceAsync(IResource resource) 147async Task WriteResourceObjectAsync<T>(T resource, Func<Task> action) where T : IResource 221private void WriteContainerFilesDestination(IResource resource) 232var source = containerFileDestination.Source; 472/// <param name="resource">The <see cref="IResource"/>.</param> 473public void WriteConnectionString(IResource resource) 485/// <see cref="EndpointAnnotation"/> entries in the <see cref="IResource.Annotations"/> 488/// <param name="resource">The <see cref="IResource"/> that contains <see cref="EndpointAnnotation"/> annotations.</param> 489public void WriteBindings(IResource resource) 530/// Writes environment variables to the manifest base on the <see cref="IResource"/> resource's <see cref="EnvironmentCallbackAnnotation"/> annotations."/> 532/// <param name="resource">The <see cref="IResource"/> which contains <see cref="EnvironmentCallbackAnnotation"/> annotations.</param> 533public async Task WriteEnvironmentVariablesAsync(IResource resource) 567/// Writes command line arguments to the manifest based on the <see cref="IResource"/> resource's <see cref="CommandLineArgsCallbackAnnotation"/> annotations. 569/// <param name="resource">The <see cref="IResource"/> that contains <see cref="CommandLineArgsCallbackAnnotation"/> annotations.</param> 571public async Task WriteCommandLineArgumentsAsync(IResource resource) 663/// Ensures that any <see cref="IResource"/> instances referenced by <paramref name="value"/> are 675if (value is IResource resource) 912foreach (var existingResource in model.Resources) 918foreach (var resource in _referencedResources.Values)
Publishing\ResourceContainerImageManager.cs (13)
143Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default); 151Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default); 158Task PushImageAsync(IResource resource, CancellationToken cancellationToken); 184IResource resource, 209public async Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 230foreach (var resource in resources) 239public async Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 300private async Task BuildProjectContainerImageAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 327private async Task ExecuteDotnetPublishAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 451private async Task BuildContainerImageFromDockerfileAsync(IResource resource, DockerfileBuildAnnotation dockerfileBuildAnnotation, string imageName, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 542public async Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 549private async Task<bool> ResourcesRequireContainerRuntimeAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken) 551foreach (var resource in resources)
RequiredCommandResourceExtensions.cs (2)
32string? helpLink = null) where T : IResource 69string? helpLink = null) where T : IResource
ResourceBuilderExtensions.cs (87)
62where T : IResource 94where T : IResource 118where T : IResource 119where TSource : IResource 167where T : IResource 190where T : IResource 211where T : IResource 758public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource 776public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource 913[AspireUnion(typeof(IResourceBuilder<IResource>), typeof(EndpointReference), typeof(string), typeof(Uri))] object source, 924IResourceBuilder<IResource> resourceBuilder => WithReferenceResource(builder, resourceBuilder, connectionName, optional, name), 938IResourceBuilder<IResource> source, 952IResourceBuilder<IResource> source, 1033IResourceBuilder<IResource> source, 1050IResourceBuilder<IResource> source, 1076IResourceBuilder<IResource> source, 1081where TCustom : class, IResource, IResourceWithCustomWithReference<TCustom> 1979where T : IResource 2003where T : IResource 2041where T : IResource 2075where T : IResource 2103where T : IResource 2126where T : IResource 2184where T : IResource 2329public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource 2347/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results 2364public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 2378IResourceBuilder<IResource> dependency, 2401/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results 2409/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 2424public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2432private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 2434if (builder.Resource as IResource == dependency.Resource) 2474/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>, this method 2489public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 2503IResourceBuilder<IResource> dependency, 2526/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/>, this method 2532/// behavior with the <see cref="WaitForStart{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 2547public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2555private static IResourceBuilder<T> WaitForStartCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 2557if (builder.Resource as IResource == dependency.Resource) 2582foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>()) 2621public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource 2655public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport 2660if (builder.Resource as IResource == dependency.Resource) 2687/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource 2715public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource 2917CommandOptions? commandOptions = null) where T : IResource 2987bool isHighlighted = false) where T : IResource 3062where TResource : IResource 3125where TResource : IResource 3183where TResource : IResource 3228where TResource : IResource 3266where TResource : IResource 4320where TResource : IResource 4440IResource resource, 4441string type) where T : IResource 4461IResourceBuilder<IResource> resourceBuilder, 4462string type) where T : IResource 4481IResource resource) where T : IResource 4500ReferenceExpression expression) where T : IResource 4511where T : IResource 4515void AddReference(IResource resource) 4527if (value is IResource resource) 4531else if (value is IResourceBuilder<IResource> resourceBuilder) 4561IResourceBuilder<IResource> resourceBuilder) where T : IResource 4597IResourceBuilder<IResource> parent) where T : IResource 4629IResource parent) where T : IResource 4663IResourceBuilder<IResource> child) where T : IResource 4697IResource child) where T : IResource 4734public static IResourceBuilder<T> WithIconName<T>(this IResourceBuilder<T> builder, string iconName, IconVariant iconVariant = IconVariant.Filled) where T : IResource 4861where T : IResource 4901where T : IResource 4958where T : IResource 5119public static IResourceBuilder<T> ExcludeFromMcp<T>(this IResourceBuilder<T> builder) where T : IResource 5139public static IResourceBuilder<T> WithHidden<T>(this IResourceBuilder<T> builder) where T : IResource 5159public static IResourceBuilder<T> WithHiddenOnCompletion<T>(this IResourceBuilder<T> builder, int exitCode) where T : IResource 5182internal static IResourceBuilder<T> WithHiddenOnCompletionExport<T>(this IResourceBuilder<T> builder, int? exitCode = null, int[]? exitCodes = null) where T : IResource 5204public static IResourceBuilder<T> WithHiddenOnCompletion<T>(this IResourceBuilder<T> builder, params int[] exitCodes) where T : IResource 5212private static IResourceBuilder<T> WithHiddenOnCompletionCore<T>(IResourceBuilder<T> builder, IReadOnlyList<int> exitCodes) where T : IResource
ResourceLoggerForwarderService.cs (1)
61private async Task WatchResourceLogs(IResource resource, string resourceId, CancellationToken cancellationToken)
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (8)
16internal static LaunchSettings? GetLaunchSettings(this IResource projectResource) 33internal static NamedLaunchProfile? GetEffectiveLaunchProfile(this IResource projectResource, bool throwIfNotFound = false) 50internal static LaunchProfile? GetLaunchProfile(this IResource projectResource, string launchProfileName, bool throwIfNotFound = false) 121private static bool TrySelectLaunchProfileByOrder(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 145private static bool TrySelectLaunchProfileFromDefaultAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 171private static bool TrySelectLaunchProfileFromAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 185internal static string? SelectLaunchProfileName(this IResource projectResource) 207internal delegate bool LaunchProfileSelector(IResource project, out string? launchProfile);
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
TerminalResourceBuilderExtensions.cs (3)
71where T : IResource 125where T : IResource 140IResource parent,
Utils\DockerfileHelper.cs (1)
22IResource resource,
Utils\ImageNameGenerator.cs (2)
14public static string GenerateImageName<T>(this IResourceBuilder<T> builder) where T : IResource 23public 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 (74)
AzureProvisioningController.cs (48)
1026IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources, 1092private static bool HasMissingAzureContextFailure(IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources) 1096private static ImmutableArray<ResourcePropertySnapshot> CreateAzureEnvironmentFailureProperties(IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources) 1110private static Exception? GetProvisioningFailureException(IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources) 1115private static string CreateProvisioningFailureMessage(IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources) 1129IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources, 1146IReadOnlyCollection<(IResource Resource, IAzureResource AzureResource)> azureResources, 1220private static List<(IResource Resource, IAzureResource AzureResource)> GetProvisionableAzureResources(DistributedApplicationModel model) 1231private static List<(IResource Resource, IAzureResource AzureResource)> GetTargetAzureResources( 1248var queue = new Queue<(IResource Resource, IAzureResource AzureResource)>(); 1249var targetResources = new List<(IResource Resource, IAzureResource AzureResource)>(); 1261foreach (var child in parentChildLookup[current.Resource]) 1271foreach (var child in parentChildLookup[current.AzureResource]) 1294void Enqueue((IResource Resource, IAzureResource AzureResource) resource) 1303private static ILookup<IResource, IResource> GetTargetParentChildLookup(DistributedApplicationModel model, bool includeAnnotationParentRelationships) 1313private static IEnumerable<IResource> GetResourceParents(IResource resource, bool includeAnnotationParentRelationships) 1339private static void ThrowIfKeyVaultLocationChangeTarget(IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> targetResources) 1360IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources, 1361IResource target, 1362out (IResource Resource, IAzureResource AzureResource) azureResource) 1377private static List<(IResource Resource, IAzureResource AzureResource)> GetActiveOperationTargetAzureResources(DistributedApplicationModel model, ActiveAzureOperation activeOperation) 2784private static string GetDeploymentStateResourceName((IResource Resource, IAzureResource AzureResource) resource) 2788IReadOnlyCollection<(IResource Resource, IAzureResource AzureResource)> targetResources, 2889IReadOnlyCollection<(IResource Resource, IAzureResource AzureResource)> targetResources, 3378private bool ShouldCheckForDrift(IResource resource) 3605private CustomResourceSnapshot ApplyActiveOperationProperties(IResource resource, CustomResourceSnapshot state) 3636foreach (var resource in GetResourcesForCommandStateRefresh(model)) 3644private static IEnumerable<IResource> GetResourcesForCommandStateRefresh(DistributedApplicationModel model) 3647var resources = new List<IResource>(); 3664void Add(IResource resource) 3674(IResource Resource, IAzureResource AzureResource) resource, 3675ILookup<IResource, IResourceWithParent> parentChildLookup, 3678async Task PublishAsync(IResource targetResource) 3714(IResource Resource, IAzureResource AzureResource) resource, 3715ILookup<IResource, IResourceWithParent> parentChildLookup) 3767IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> targetResources, 3785(IResource Resource, IAzureResource AzureResource) resource, 3786ILookup<IResource, IResourceWithParent> parentChildLookup) 3854(IResource Resource, IAzureResource AzureResource) resource, 3855ILookup<IResource, IResourceWithParent> parentChildLookup) 3884IReadOnlyList<(IResource Resource, IAzureResource AzureResource)> azureResources, 3885ILookup<IResource, IResourceWithParent> parentChildLookup, 3907(IResource Resource, IAzureResource AzureResource) resource, 3908ILookup<IResource, IResourceWithParent> parentChildLookup, 4096IResource targetResource, 4097ILookup<IResource, IResourceWithParent> parentChildLookup,
AzurePublishingContext.cs (1)
374foreach (var resource in model.Resources)
AzureResourcePreparer.cs (15)
63private static void AddPerResourceCommands(List<(IResource Resource, IAzureResource AzureResource)> azureResources) 98private static string GetDeploymentStateResourceName((IResource Resource, IAzureResource AzureResource) resource) 102IResource resource, 128internal static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel) 135var azureResources = new List<(IResource, IAzureResource)>(); 136foreach (var resource in appModel.Resources) 167foreach (var resource in appModel.Resources) 181private async Task BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List<(IResource Resource, IAzureResource AzureResource)> azureResources, CancellationToken cancellationToken) 211foreach (var resource in resourceSnapshot) 273foreach (var dependency in directDependencies) 361private static Dictionary<AzureProvisioningResource, IEnumerable<RoleDefinition>> GetAllRoleAssignments(IResource resource) 380IResource resource, 410IResource resource, 510if (!appModel.Resources.TryGetByName(roleAssignmentResource.Name, out var existingResource)) 528private static void AddDeploymentPrerequisitesAnnotation(IResource resource, HashSet<AzureBicepResource> prerequisiteResources)
AzureRoleAssignmentResource.cs (4)
27IResource? ownerResource, 47public IResource? OwnerResource { get; } = ValidateOwnerAndIdentity(ownerResource, identityResource); 55private static IResource? ValidateOwnerAndIdentity(IResource? ownerResource, AzureUserAssignedIdentityResource? identityResource)
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 (2)
22public static bool IsExisting(this IResource resource) 37return ((IResource)resource).IsExisting();
IAzureKeyVaultSecretReference.cs (2)
28/// The <see cref="IResource"/> that is responsible for writing this secret to the Key Vault, or <c>null</c> if not set. 33public IResource? SecretOwner
IAzureResource.cs (1)
7/// Represents an Azure resource, as a marker interface for <see cref="IResource"/>'s
Aspire.Hosting.Azure.AppConfiguration (4)
AzureAppConfigurationExtensions.cs (2)
206where T : IResource 226where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.AppContainers (28)
AzureContainerAppEnvironmentResource.cs (8)
84foreach (var computeResource in model.GetComputeResources()) 86var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 122foreach (var computeResource in context.Model.GetComputeResources()) 124var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 142foreach (var computeResource in context.Model.GetBuildResources()) 206foreach (var r in appModel.GetComputeResources()) 290internal Dictionary<string, (IResource resource, ContainerMountAnnotation volume, int index, BicepOutputReference outputReference)> VolumeNames { get; } = []; 391internal BicepOutputReference GetVolumeStorage(IResource resource, ContainerMountAnnotation volume, int volumeIndex)
AzureContainerAppExtensions.cs (1)
82foreach (var r in ctx.Model.GetComputeResources())
AzureContainerAppResource.cs (2)
25public AzureContainerAppResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 106public IResource TargetResource { get; }
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)
24private readonly Dictionary<IResource, BaseContainerAppContext> _containerApps = new(new ResourceNameComparer()); 62public BaseContainerAppContext GetContainerAppContext(IResource resource) 72public async Task<AzureBicepResource> CreateContainerAppAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken) 97private BaseContainerAppContext CreateContainerAppContext(IResource resource)
ContainerAppJobContext.cs (1)
12internal sealed class ContainerAppJobContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
src\Shared\CrossScopeAcrPullIdentityPreparer.cs (3)
45where TEnvironment : IResource, IAzureComputeEnvironmentResource 76where TEnvironment : IResource, IAzureComputeEnvironmentResource 108where TEnvironment : IResource, IAzureComputeEnvironmentResource
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 (25)
AzureAppServiceEnvironmentContext.cs (3)
24private readonly Dictionary<IResource, AzureAppServiceWebsiteContext> _appServices = new(new ResourceNameComparer()); 62public AzureAppServiceWebsiteContext GetAppServiceContext(IResource resource) 72public async Task<AzureBicepResource> CreateAppServiceAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken)
AzureAppServiceEnvironmentExtensions.cs (1)
56foreach (var r in ctx.Model.GetComputeResources())
AzureAppServiceEnvironmentResource.cs (9)
101foreach (var computeResource in model.GetComputeResources()) 103var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 139foreach (var computeResource in context.Model.GetComputeResources()) 141var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 159foreach (var computeResource in context.Model.GetBuildResources()) 212foreach (var resource in appModel.GetComputeResources()) 269foreach (var computeResource in model.GetComputeResources()) 271var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 316private static string? ValidateEnvironmentVariableNames(IResource resource, AzureAppServiceWebsiteContext appServiceContext)
AzureAppServiceWebsiteContext.cs (2)
18IResource resource, 21public IResource Resource => resource;
AzureAppServiceWebSiteResource.cs (2)
25public AzureAppServiceWebSiteResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 104public IResource TargetResource { get; }
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
src\Shared\CrossScopeAcrPullIdentityPreparer.cs (3)
45where TEnvironment : IResource, IAzureComputeEnvironmentResource 76where TEnvironment : IResource, IAzureComputeEnvironmentResource 108where TEnvironment : IResource, IAzureComputeEnvironmentResource
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 (4)
AzureOpenAIExtensions.cs (2)
251where T : IResource 271where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ContainerRegistry (7)
AzureContainerRegistryExtensions.cs (5)
68foreach (var resource in beforeStartEvent.Model.Resources) 90where T : IResource, IComputeEnvironmentResource 114where T : IResource, IAzureComputeEnvironmentResource 261where T : IResource 281where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.EventHubs (4)
AzureEventHubsExtensions.cs (2)
526where T : IResource 546where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.FrontDoor (2)
AzureFrontDoorExtensions.cs (1)
202private static IComputeEnvironmentResource GetEffectiveComputeEnvironment(IResource resource)
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
Aspire.Hosting.Azure.Functions (12)
AzureFunctionsProjectResourceExtensions.cs (1)
359IResourceBuilder<IResource> source,
AzureFunctionsResource.cs (1)
23IResourceBuilder<IResource> source,
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (8)
16internal static LaunchSettings? GetLaunchSettings(this IResource projectResource) 33internal static NamedLaunchProfile? GetEffectiveLaunchProfile(this IResource projectResource, bool throwIfNotFound = false) 50internal static LaunchProfile? GetLaunchProfile(this IResource projectResource, string launchProfileName, bool throwIfNotFound = false) 121private static bool TrySelectLaunchProfileByOrder(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 145private static bool TrySelectLaunchProfileFromDefaultAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 171private static bool TrySelectLaunchProfileFromAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 185internal static string? SelectLaunchProfileName(this IResource projectResource) 207internal delegate bool LaunchProfileSelector(IResource project, out string? launchProfile);
Aspire.Hosting.Azure.KeyVault (6)
AzureKeyVaultResourceExtensions.cs (2)
178where T : IResource 198where 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.Kubernetes (2)
AzureKubernetesEnvironmentResource.AksPipeline.cs (2)
60foreach (var r in appModel.GetComputeResources()) 165if (appModel.Resources.TryGetByName("workload", out var existingResource) && existingResource is AksNodePoolResource existingPool)
Aspire.Hosting.Azure.Kusto (3)
AzureKustoBuilderExtensions.cs (1)
35/// 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 (2)
AzureNetworkSecurityPerimeterExtensions.cs (1)
139string? associationName = null) where T : IResource, IAzureNspAssociationTarget
AzurePrivateEndpointExtensions.cs (1)
82IResource rootResource = target.Resource;
Aspire.Hosting.Azure.Search (4)
AzureSearchExtensions.cs (2)
138where T : IResource 158where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ServiceBus (4)
AzureServiceBusExtensions.cs (2)
682where T : IResource 702where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.SignalR (4)
AzureSignalRExtensions.cs (2)
206where T : IResource 226where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Sql (4)
AzureSqlServerResource.cs (4)
609public IResource Parent => storage; 727private sealed class FakeBuilder<T>(T resource, IDistributedApplicationBuilder applicationBuilder) : IResourceBuilder<T> where T : IResource 752public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource 757public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource
Aspire.Hosting.Azure.Storage (4)
AzureStorageExtensions.cs (2)
732where T : IResource 757where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Tests (86)
AzureAppServiceTests.cs (3)
413var container = Assert.Single(model.GetContainerResources()); 449var container = Assert.Single(model.GetContainerResources()); 1398private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepProvisionerTests.cs (1)
1748private static async Task<IReadOnlyList<(string Content, bool IsErrorMessage)>> ReadInitialResourceLogsAsync(ResourceLoggerService loggerService, IResource resource)
AzureBicepResourceTests.cs (6)
32public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensions => 35private static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> CreateAllAzureExtensions(string resourceName) 75public void AzureExtensionsAutomaticallyAddAzureProvisioning(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 87public void BicepResourcesAreIdempotent(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 103public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensionsWithHyphen => 108public void AzureResourcesProduceValidBicep(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
AzureContainerAppEnvironmentExtensionsTests.cs (1)
598var api = model.Resources.First(r => r.Name == "api");
AzureContainerAppsTests.cs (41)
44var container = Assert.Single(model.GetContainerResources()); 78var container = Assert.Single(model.GetContainerResources()); 235var container = Assert.Single(model.GetContainerResources()); 278var container = Assert.Single(model.GetContainerResources()); 308var container = Assert.Single(model.GetContainerResources()); 501var container = Assert.Single(model.GetContainerResources()); 533var container = Assert.Single(model.GetContainerResources()); 567var container = Assert.Single(model.GetContainerResources()); 603var container = Assert.Single(model.GetContainerResources()); 641var container = Assert.Single(model.GetContainerResources()); 681var container = Assert.Single(model.GetContainerResources()); 713var container = Assert.Single(model.GetContainerResources()); 746var container = Assert.Single(model.GetContainerResources()); 797var container = Assert.Single(model.GetContainerResources()); 879var container = Assert.Single(model.GetContainerResources()); 928var container = Assert.Single(model.GetContainerResources()); 959var container = Assert.Single(model.GetContainerResources()); 991var container = Assert.Single(model.GetContainerResources()); 1281var container = Assert.Single(model.GetContainerResources()); 1312var container = Assert.Single(model.GetContainerResources()); 1348var container = Assert.Single(model.GetContainerResources()); 1379var container = Assert.Single(model.GetContainerResources()); 1722var container = Assert.Single(model.GetContainerResources()); 1745private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) => 1769var container = Assert.Single(model.GetContainerResources()); 2332var container = Assert.Single(model.GetContainerResources()); 2391var funcjob = model.Resources.Single(r => r.Name == "funcjob"); 2435var batch = containers.First(c => c.Name == "batch"); 2436var web = containers.First(c => c.Name == "web"); 2472var container = Assert.Single(model.GetContainerResources()); 2502var container = Assert.Single(model.GetContainerResources()); 2541var container = Assert.Single(model.GetContainerResources()); 2581var container = Assert.Single(model.GetContainerResources()); 2621var container = Assert.Single(model.GetContainerResources()); 2666var container = model.Resources.Single(r => r.Name == "api"); 2670var buildOnly = model.Resources.Single(r => r.Name == "build-only"); 2696var container = Assert.Single(model.GetContainerResources()); 2914var webappAcaResource = model.Resources.First(r => r.Name == "webappaca"); 2920var webappServiceResource = model.Resources.First(r => r.Name == "webappservice"); 2926var containerAcaResource = model.Resources.First(r => r.Name == "containeraca"); 2934var containerAppServiceResource = model.Resources.First(r => r.Name == "containerappservice");
AzureDeployerTests.cs (1)
189var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
AzureEventHubsExtensionsTests.cs (6)
524var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage"); 528var sourceResource = GetPersistenceReferenceSource(azurite); 542var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage"); 557private static IResource GetPersistenceReferenceSource(IResource resource) 560return Assert.IsAssignableFrom<IResource>(annotation.SourceResource);
AzureFunctionsTests.cs (4)
25&& parameters[1].ParameterType == typeof(IResourceBuilder<IResource>)); 291InvokeWithReference(funcApp, (IResourceBuilder<IResource>)blobs, connectionName: "input"); 457private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) => 809IResourceBuilder<IResource> source,
AzureManagedRedisExtensionsTests.cs (1)
133var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureManifestUtils.cs (3)
16public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) => 19public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) => 22private 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");
AzureRunAsEmulatorModeTests.cs (5)
11public static TheoryData<string, Func<IDistributedApplicationBuilder, Action, IResource>> RunAsEmulatorResources => new() 25public void RunAsEmulator_InRunMode_ConfiguresLocalContainer(string resourceType, Func<IDistributedApplicationBuilder, Action, IResource> addResource) 30var resource = addResource(builder, () => callbackInvoked = true); 39public void RunAsEmulator_InPublishMode_DoesNotConfigureLocalContainer(string resourceType, Func<IDistributedApplicationBuilder, Action, IResource> addResource) 44var resource = addResource(builder, () => callbackInvoked = true);
AzureServiceBusExtensionsTests.cs (6)
621var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql"); 625var sourceResource = GetPersistenceReferenceSource(sql); 639var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql"); 654private static IResource GetPersistenceReferenceSource(IResource resource) 657return Assert.IsAssignableFrom<IResource>(annotation.SourceResource);
AzureSqlExtensionsTests.cs (2)
217var sqlResourceInModel = builder.Resources.Single(r => r.Name == "sql"); 218var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
ContainerRegistryTests.cs (1)
154foreach (var resource in model.Resources)
RoleAssignmentTests.cs (1)
373private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.Azure.WebPubSub (4)
AzureWebPubSubExtensions.cs (2)
323where T : IResource 343where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Blazor (17)
BlazorGatewayExtensions.cs (9)
403where TGateway : class, IResource 422where TGateway : class, IResource 533where TGateway : class, IResource 606private static List<EndpointReferenceAnnotation> GetServiceDiscoveryReferences(IResource resource) 643private static HashSet<string> GetReferencedResourceNames(IResource resource) 687private static GatewayAppsAnnotation GetOrAddGatewayAppsAnnotation(IResource resource) 699private static List<GatewayAppRegistration> GetRegisteredApps(IResource resource) 709private static List<EndpointAnnotation> GetAllocatedEndpoints(IResource resource) 756&& model.Resources.TryGetByName("aspire-dashboard", out var resource)
BlazorHostedExtensions.cs (2)
164private static HostedClientAnnotation GetOrAddHostedClientAnnotation(IResource resource) 176private static HashSet<string> GetReferencedResourceNames(IResource resource)
BrowserDebuggerHelper.cs (5)
40IResourceBuilder<IResource> commandTarget, 63IResourceBuilder<IResource> commandTarget, 290IResource commandTargetResource, 291IResource debuggerResource, 340private static string GetDcpInstanceName(IResource resource)
Resources\BlazorWasmAppResource.cs (1)
39public IResource Parent { get; internal set; } = null!;
Aspire.Hosting.Blazor.Tests (16)
BlazorHostedExtensionsTests.cs (14)
28var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 49var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 70var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 88var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 111var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 140var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 293var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 313var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 358var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 430var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 449var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 498IResource resource, IDistributedApplicationBuilder builder) 505IResource resource, IDistributedApplicationBuilder builder) 530private static async Task<BrowserLaunchConfiguration> CreateBrowserLaunchConfigurationAsync(IResource resource)
BrowserDebuggerHelperTests.cs (1)
144IResource resource)
WithBlazorAppTests.cs (1)
487private static async Task<BrowserLaunchConfiguration> CreateBrowserLaunchConfigurationAsync(IResource resource)
Aspire.Hosting.CodeGeneration.Go.Tests (24)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (24)
158bool enabled = true) where T : IResource 171double multiplier = 1.5) where T : IResource 463TestConfigDto config) where T : IResource 520DateTime createdAt) where T : IResource 532DateTimeOffset modifiedAt) where T : IResource 544Guid correlationId) where T : IResource 556Func<TestCallbackContext, Task>? callback = null) where T : IResource 569TestResourceStatus status) where T : IResource 581TestNestedDto config) where T : IResource 593Func<TestResourceContext, Task<bool>> validator) where T : IResource 606IResourceBuilder<IResource> dependency) where T : IResource 659IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 672[AspireUnion(typeof(string), typeof(IResourceBuilder<IResourceWithConnectionString>))] object dependency) where T : IResource 684IReadOnlyList<string> endpoints) where T : IResource 722Func<CancellationToken, Task> operation) where T : IResource 842string label) where T : IResource 855string category) where T : IResource 869int port) where T : IResource 883string scheme) where T : IResource 898int? maxFiles = null) where T : IResource 913int? maxFiles = null) where T : IResource 929int priority) where T : IResource 946string middleware) where T : IResource
Aspire.Hosting.CodeGeneration.Java.Tests (24)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (24)
158bool enabled = true) where T : IResource 171double multiplier = 1.5) where T : IResource 463TestConfigDto config) where T : IResource 520DateTime createdAt) where T : IResource 532DateTimeOffset modifiedAt) where T : IResource 544Guid correlationId) where T : IResource 556Func<TestCallbackContext, Task>? callback = null) where T : IResource 569TestResourceStatus status) where T : IResource 581TestNestedDto config) where T : IResource 593Func<TestResourceContext, Task<bool>> validator) where T : IResource 606IResourceBuilder<IResource> dependency) where T : IResource 659IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 672[AspireUnion(typeof(string), typeof(IResourceBuilder<IResourceWithConnectionString>))] object dependency) where T : IResource 684IReadOnlyList<string> endpoints) where T : IResource 722Func<CancellationToken, Task> operation) where T : IResource 842string label) where T : IResource 855string category) where T : IResource 869int port) where T : IResource 883string scheme) where T : IResource 898int? maxFiles = null) where T : IResource 913int? maxFiles = null) where T : IResource 929int priority) where T : IResource 946string middleware) where T : IResource
Aspire.Hosting.CodeGeneration.Python.Tests (24)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (24)
158bool enabled = true) where T : IResource 171double multiplier = 1.5) where T : IResource 463TestConfigDto config) where T : IResource 520DateTime createdAt) where T : IResource 532DateTimeOffset modifiedAt) where T : IResource 544Guid correlationId) where T : IResource 556Func<TestCallbackContext, Task>? callback = null) where T : IResource 569TestResourceStatus status) where T : IResource 581TestNestedDto config) where T : IResource 593Func<TestResourceContext, Task<bool>> validator) where T : IResource 606IResourceBuilder<IResource> dependency) where T : IResource 659IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 672[AspireUnion(typeof(string), typeof(IResourceBuilder<IResourceWithConnectionString>))] object dependency) where T : IResource 684IReadOnlyList<string> endpoints) where T : IResource 722Func<CancellationToken, Task> operation) where T : IResource 842string label) where T : IResource 855string category) where T : IResource 869int port) where T : IResource 883string scheme) where T : IResource 898int? maxFiles = null) where T : IResource 913int? maxFiles = null) where T : IResource 929int priority) where T : IResource 946string middleware) where T : IResource
Aspire.Hosting.CodeGeneration.Rust.Tests (24)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (24)
158bool enabled = true) where T : IResource 171double multiplier = 1.5) where T : IResource 463TestConfigDto config) where T : IResource 520DateTime createdAt) where T : IResource 532DateTimeOffset modifiedAt) where T : IResource 544Guid correlationId) where T : IResource 556Func<TestCallbackContext, Task>? callback = null) where T : IResource 569TestResourceStatus status) where T : IResource 581TestNestedDto config) where T : IResource 593Func<TestResourceContext, Task<bool>> validator) where T : IResource 606IResourceBuilder<IResource> dependency) where T : IResource 659IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 672[AspireUnion(typeof(string), typeof(IResourceBuilder<IResourceWithConnectionString>))] object dependency) where T : IResource 684IReadOnlyList<string> endpoints) where T : IResource 722Func<CancellationToken, Task> operation) where T : IResource 842string label) where T : IResource 855string category) where T : IResource 869int port) where T : IResource 883string scheme) where T : IResource 898int? maxFiles = null) where T : IResource 913int? maxFiles = null) where T : IResource 929int priority) where T : IResource 946string middleware) where T : IResource
Aspire.Hosting.CodeGeneration.TypeScript.Tests (26)
AtsTypeScriptCodeGeneratorTests.cs (2)
1259where TResource : IResource 1507private static AtsTypeRef CreateResourceTypeRef<TResource>() where TResource : IResource =>
TestTypes\TestExtensions.cs (24)
158bool enabled = true) where T : IResource 171double multiplier = 1.5) where T : IResource 463TestConfigDto config) where T : IResource 520DateTime createdAt) where T : IResource 532DateTimeOffset modifiedAt) where T : IResource 544Guid correlationId) where T : IResource 556Func<TestCallbackContext, Task>? callback = null) where T : IResource 569TestResourceStatus status) where T : IResource 581TestNestedDto config) where T : IResource 593Func<TestResourceContext, Task<bool>> validator) where T : IResource 606IResourceBuilder<IResource> dependency) where T : IResource 659IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 672[AspireUnion(typeof(string), typeof(IResourceBuilder<IResourceWithConnectionString>))] object dependency) where T : IResource 684IReadOnlyList<string> endpoints) where T : IResource 722Func<CancellationToken, Task> operation) where T : IResource 842string label) where T : IResource 855string category) where T : IResource 869int port) where T : IResource 883string scheme) where T : IResource 898int? maxFiles = null) where T : IResource 913int? maxFiles = null) where T : IResource 929int priority) where T : IResource 946string middleware) where T : IResource
Aspire.Hosting.Containers.Tests (14)
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); 174var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 208var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 236var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 255var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 304var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 351var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources());
ResourceFailureLoggingTests.cs (1)
116where T : IResource
WithDockerfileTests.cs (2)
962var resource = Assert.Single(containerResources); 1007var resource1 = Assert.Single(containerResources1);
Aspire.Hosting.DevTunnels (7)
DevTunnelResourceBuilderExtensions.cs (3)
373/// This method is not available in polyglot app hosts. Use <see cref="GetEndpoint(IResourceBuilder{DevTunnelResource}, IResource, string)"/> instead. 403public static EndpointReference GetEndpoint(this IResourceBuilder<DevTunnelResource> tunnelBuilder, IResource resource, string endpointName) 444private 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.DevTunnels.Tests (1)
DevTunnelResourceBuilderExtensionsTests.cs (1)
717public Task<RequiredCommandValidationResult> ValidateAsync(IResource resource, RequiredCommandAnnotation annotation, CancellationToken cancellationToken)
Aspire.Hosting.Docker (28)
CapturedEnvironmentVariable.cs (1)
46public IResource? Resource { get; set; }
DockerComposeEnvironmentContext.cs (1)
12public async Task<DockerComposeServiceResource> CreateDockerComposeServiceResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
DockerComposeEnvironmentExtensions.cs (1)
44foreach (var r in ctx.Model.GetComputeResources())
DockerComposeEnvironmentResource.cs (11)
55internal Dictionary<IResource, DockerComposeServiceResource> ResourceMapping { get; } = new(new ResourceNameComparer()); 91foreach (var resource in resources) 93var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 216foreach (var resource in resources) 218var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 241foreach (var computeResource in context.Model.GetBuildResources()) 251foreach (var pushResource in context.Model.GetBuildAndPushResources()) 321foreach (var r in appModel.GetComputeResources()) 363private bool IsAlreadyTargeted(IResource resource) => 385private static void ConfigureOtlp(IResource resource, EndpointReference otlpEndpoint) 553internal string AddEnvironmentVariable(string name, string? description = null, string? defaultValue = null, object? source = null, IResource? resource = null)
DockerComposePublishingContext.cs (3)
77IEnumerable<IResource> resources = environment.Dashboard?.Resource is IResource r 81foreach (var resource in resources)
DockerComposeServiceExtensions.cs (2)
117var resourceInstance = dockerComposeService.TargetResource; 131var 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 (14)
DockerComposePublisherTests.cs (3)
1137public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 1143public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 1149public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
DockerComposeTests.cs (11)
289public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 295public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 301public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 741public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 744public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 747public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 888var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 894var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 900var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 906var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 939var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker");
Aspire.Hosting.Dotnet (9)
DotnetProjectHostingExtensions.cs (1)
185List<string> GetLaunchProfileArguments(IResource resource)
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (8)
16internal static LaunchSettings? GetLaunchSettings(this IResource projectResource) 33internal static NamedLaunchProfile? GetEffectiveLaunchProfile(this IResource projectResource, bool throwIfNotFound = false) 50internal static LaunchProfile? GetLaunchProfile(this IResource projectResource, string launchProfileName, bool throwIfNotFound = false) 121private static bool TrySelectLaunchProfileByOrder(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 145private static bool TrySelectLaunchProfileFromDefaultAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 171private static bool TrySelectLaunchProfileFromAnnotation(IResource projectResource, [NotNullWhen(true)] out string? launchProfileName) 185internal static string? SelectLaunchProfileName(this IResource projectResource) 207internal delegate bool LaunchProfileSelector(IResource project, out string? launchProfile);
Aspire.Hosting.EntityFrameworkCore (4)
EFMigrationResourceBuilderExtensions.cs (4)
406Func<TAnnotation, IResource?> resourceSelector) 425private static bool IsAncestorOf(IResource candidate, IResource descendant) 429var current = descendant;
Aspire.Hosting.EntityFrameworkCore.Tests (2)
EFMigrationPipelineTests.cs (2)
241var waitedResource = waitAnnotations[0].Resource; 678Assert.Contains((IResource)database.Resource, waitedResources);
Aspire.Hosting.Foundry (12)
FoundryExtensions.cs (2)
243where T : IResource 263where T : IResource
HostedAgent\AzureHostedAgentResource.cs (7)
37public AzureHostedAgentResource([ResourceName] string name, IResource target, Action<HostedAgentConfiguration>? configure = null) : base(name) 103public IResource Target { get; } 305IResource resource, 389IResource resource, 429IResource resource, 464IResource resource, 497IResource resource,
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
Aspire.Hosting.Foundry.Tests (4)
HostedAgentExtensionTests.cs (3)
80var resource = builder.Resources.Single(r => r.Name == "agent"); 105var resource = builder.Resources.Single(r => r.Name == "agent"); 135var resource = builder.Resources.Single(r => r.Name == "agent");
PromptAgentTests.cs (1)
76var resource = builder.Resources.Single(r => r.Name == "my-agent");
Aspire.Hosting.Go (3)
GoHostingExtensions.cs (3)
803private static string BuildDockerGoCommand(IResource resource, string packagePath = ".", string binaryName = "app") 818private static string BuildFlagsString(IResource resource) => 826private static List<string> BuildFlagParts(IResource resource, bool includeRace = true)
Aspire.Hosting.Go.Tests (7)
AddGoAppTests.cs (7)
1102var tidyResource = builder.Resources.First(r => r.Name == "api-mod-tidy"); 1103var vendorResource = builder.Resources.First(r => r.Name == "api-mod-vendor"); 1120var tidyResource = builder.Resources.First(r => r.Name == "api-mod-tidy"); 1121var downloadResource = builder.Resources.First(r => r.Name == "api-mod-download"); 1137var vendorResource = builder.Resources.First(r => r.Name == "api-mod-vendor"); 1138var downloadResource = builder.Resources.First(r => r.Name == "api-mod-download"); 1186private static async Task<GoLaunchConfiguration> CreateLaunchConfigurationAsync(IResource resource)
Aspire.Hosting.Java (1)
JavaHostingExtensions.cs (1)
1138internal static string ResolveOtelAgentPath(IResource resource, JavaOtelAgentAnnotation annotation)
Aspire.Hosting.Java.Tests (6)
AddJavaAppTests.cs (4)
1047var buildResource = builder.Resources.First(r => r.Name == "api-maven-build"); 1073var buildResource = builder.Resources.First(r => r.Name == "api-gradle-build"); 1152var buildResource = builder.Resources.First(r => r.Name == "api-maven-build"); 1166var buildResource = builder.Resources.First(r => r.Name == "api-gradle-build");
AddSpringBootAppTests.cs (1)
388var buildResource = Assert.Single(builder.Resources, r => r.Name == "catalog-maven-build");
TestEndpointAllocator.cs (1)
15public static void AllocateEndpoints(IResource resource)
Aspire.Hosting.JavaScript (2)
JavaScriptHostingExtensions.cs (2)
385private static IEnumerable<(string Command, string? HelpLink)> ResolveRequiredCommands(IResource resource, string runtimeCommand) 2302private static void ValidateBrowserCapability<T>(IResourceBuilder<T> builder) where T : IResource
Aspire.Hosting.JavaScript.Tests (9)
AddBunAppTests.cs (1)
396private static async Task<JavaScriptLaunchConfiguration> CreateLaunchConfigurationAsync(IResource resource)
AddNodeAppTests.cs (3)
22&& parameters[1].ParameterType == typeof(IResourceBuilder<IResource>)); 583IResourceBuilder<IResource> source, 628private static async Task<JavaScriptLaunchConfiguration> CreateLaunchConfigurationAsync(IResource resource)
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");
RequiredCommandTests.cs (1)
202private static async Task<string[]> GetRequiredCommandsAsync(IDistributedApplicationBuilder builder, IResource resource)
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)
161var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal)); 186var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal));
Aspire.Hosting.Kubernetes (46)
Deployment\HelmDeploymentEngine.cs (1)
510IResource computeResource,
Extensions\ResourceExtensions.cs (7)
14internal static Deployment ToDeployment(this IResource resource, KubernetesResource context) 43internal static StatefulSet ToStatefulSet(this IResource resource, KubernetesResource context) 63internal static Secret? ToSecret(this IResource resource, KubernetesResource context) 97internal static ConfigMap? ToConfigMap(this IResource resource, KubernetesResource context) 129internal static Service? ToService(this IResource resource, KubernetesResource context) 186private static PodTemplateSpecV1 ToPodTemplateSpec(this IResource resource, KubernetesResource context) 295private static ContainerV1 ToContainerV1(this IResource resource, KubernetesResource context)
KubernetesEnvironmentContext.cs (2)
11private readonly Dictionary<IResource, KubernetesResource> _kubernetesComponents = new(new ResourceNameComparer()); 15public async Task<KubernetesResource> CreateKubernetesResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
KubernetesEnvironmentExtensions.cs (2)
52foreach (var r in ctx.Model.GetComputeResources()) 286where T : IResource
KubernetesEnvironmentResource.cs (16)
184internal sealed record CapturedHelmImageReference(string Section, string ResourceKey, string ValueKey, IResource Resource); 206internal sealed record TlsSecretRequest(ReferenceExpression SecretName, ReferenceExpression Hostname, IResource Owner); 333foreach (var computeResource in resources) 336var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(targetEnv)?.DeploymentTarget; 370foreach (var computeResource in resources) 373var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(targetEnv)?.DeploymentTarget; 459var deploymentTargets = new Dictionary<IResource, KubernetesResource>(new ResourceNameComparer()); 461foreach (var r in appModel.GetComputeResources()) 570private static void ConfigureOtlp(IResource resource, EndpointReference otlpEndpoint) 715private async Task ProcessIngressResources(DistributedApplicationModel model, Dictionary<IResource, KubernetesResource> deploymentTargets, ILogger logger, CancellationToken cancellationToken) 755Dictionary<IResource, KubernetesResource> deploymentTargets, 920Dictionary<IResource, KubernetesResource> deploymentTargets, 956private async Task ProcessGatewayResources(DistributedApplicationModel model, Dictionary<IResource, KubernetesResource> deploymentTargets, ILogger logger, CancellationToken cancellationToken) 1053Dictionary<IResource, KubernetesResource> deploymentTargets, 1229Dictionary<IResource, KubernetesResource> deploymentTargets, 1314internal static bool OwnerWasMaterialized(IResource owner) => owner switch
KubernetesPublishingContext.cs (7)
74IEnumerable<IResource> resources = environment.DashboardEnabled && environment.Dashboard?.Resource is IResource dashboardResource 78foreach (var resource in resources) 186private async Task AppendResourceContextToHelmValuesAsync(IResource resource, KubernetesResource resourceContext) 212IResource resource, 256IResource resource, 366private async Task WriteKubernetesTemplatesForResource(IResource resource, IEnumerable<BaseKubernetesResource> templatedItems)
KubernetesResource.cs (6)
22public partial class KubernetesResource(string name, IResource resource, KubernetesEnvironmentResource kubernetesEnvironmentResource) : Resource(name), IResourceWithParent<KubernetesEnvironmentResource> 112internal IResource TargetResource => resource; 198internal string GetContainerImageName(IResource resourceInstance) 801private static HelmValue AllocateParameter(ParameterResource parameter, IResource resource, bool isEmbedded) 819private static HelmValue ResolveUnknownValue(IManifestExpressionProvider parameter, IResource resource) 951public IResource? ImageResource { get; init; }
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
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.Kubernetes.Tests (7)
KubernetesEnvironmentResourceTests.cs (6)
169var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 175var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 181var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 187var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 226var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 227var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker");
PipelineStepTestHelpers.cs (1)
23public static async Task<List<PipelineStep>> CreateStepsAsync(IServiceProvider services, IResource resource)
Aspire.Hosting.Maui (10)
Lifecycle\MauiBuildQueueEventSubscriber.cs (4)
54var resource = @event.Resource; 135internal virtual async Task RunBuildAsync(IResource resource, ILogger logger, CancellationToken cancellationToken) 283IResource resource, SemaphoreSlim semaphore, string? stateAtCallTime, 340private void EnsureStopCommandReplaced(IResource resource, MauiBuildQueueAnnotation queueAnnotation)
Lifecycle\UnsupportedPlatformEventSubscriber.cs (1)
28foreach (var resource in @event.Model.Resources)
MauiOtlpExtensions.cs (1)
189private static bool TryResolveDashboardOtlpEndpoint(IResource resource, out OtlpEndpointTarget target)
Utilities\MauiAndroidEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Utilities\MauiEnvironmentHelper.cs (2)
35IResource resource, 222IResource resource,
Utilities\MauiiOSEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Aspire.Hosting.Maui.Tests (22)
MauiBuildQueueTests.cs (10)
741private static void AddOriginalStopCommand(IResource resource, Action? onExecute = null) 786private static async Task WaitForStateAsync(BuildQueueTestEnvironment env, IResource resource, string state) 820public Task WaitForBuildStartedAsync(IResource resource, TimeSpan? timeout = null) 826public void CompleteBuild(IResource resource) 832public void CompleteBuildImmediately(IResource resource) 838public void FailBuild(IResource resource, string message) 845public void FailBuildWith(IResource resource, Exception exception) 851internal override async Task RunBuildAsync(IResource resource, ILogger logger, CancellationToken cancellationToken) 886internal override Task ReleaseSemaphoreAfterLaunchAsync(IResource resource, SemaphoreSlim semaphore, string? stateAtCallTime, ILogger logger, CancellationToken cancellationToken) 912internal override Task ReleaseSemaphoreAfterLaunchAsync(IResource resource, SemaphoreSlim semaphore, string? stateAtCallTime, ILogger logger, CancellationToken cancellationToken)
MauiOtlpTemplateTests.cs (1)
92private static IResourceBuilder<IResource> AddPlatformByName(
MauiPlatformExtensionsTests.cs (10)
195var resource = platform.Resource; 513IResource resource; 568IResource resource; 882private static Task<SerializedMauiLaunchConfiguration> GetSingleMauiLaunchConfigurationAsync(IResource resource) 891private static async Task<SerializedMauiLaunchConfiguration> DeserializeLaunchConfigurationAsync(IResource resource) 923public Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> AddPlatformWithDefaultName { get; } 924public Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> AddPlatformWithCustomName { get; } 925public Action<IResourceBuilder<IResource>> ApplyWithOtlpDevTunnel { get; } 938Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> addDefault, 939Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> addCustom,
MauiWithArgsTests.cs (1)
221var platforms = new (IResourceBuilder<IResource> Builder, string ExpectedTfm)[]
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)
105/// 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.Orleans.Tests (1)
OrleansProviderTypeTests.cs (1)
118private static async Task<Dictionary<string, object>> GetEnvironmentVariablesAsync(IResource resource, IDistributedApplicationBuilder builder)
Aspire.Hosting.PostgreSQL (3)
PostgresBuilderExtensions.cs (3)
40/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 137/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 385if (builder.ApplicationBuilder.Resources.TryGetByName(containerName, out var existingResource) && existingResource is PostgresMcpContainerResource existing)
Aspire.Hosting.PostgreSQL.Tests (9)
AddPostgresTests.cs (9)
55var containerResource = Assert.Single(appModel.GetContainerResources()); 109var containerResource = Assert.Single(appModel.GetContainerResources()); 225var containerResource = Assert.Single(containerResources); 405var container = builder.Resources.Single(r => r.Name == "pgadmin"); 459var container = builder.Resources.Single(r => r.Name == "pgadmin"); 493var pgadmin = builder.Resources.Single(r => r.Name.Equals("pgadmin")); 558var pgweb = builder.Resources.Single(r => r.Name.Equals("pgweb")); 739&& parameters[1].ParameterType == typeof(IResourceBuilder<IResource>)); 743IResourceBuilder<IResource> source,
Aspire.Hosting.Python.Tests (1)
AddPythonAppTests.cs (1)
1631private static async Task<PythonLaunchConfiguration> CreateLaunchConfigurationAsync(IResource resource)
Aspire.Hosting.Qdrant (1)
QdrantServerResource.cs (1)
107IResourceBuilder<IResource> source,
Aspire.Hosting.Qdrant.Tests (6)
AddQdrantTests.cs (5)
22&& parameters[1].ParameterType == typeof(IResourceBuilder<IResource>)); 54var containerResource = Assert.Single(appModel.GetContainerResources()); 93var containerResource = Assert.Single(appModel.GetContainerResources()); 126var containerResource = Assert.Single(appModel.GetContainerResources()); 352IResourceBuilder<IResource> source,
QdrantFunctionalTests.cs (1)
234var qdrantResource = builder.Resources.Single(r => r.Name.Equals("qdrant"));
Aspire.Hosting.Radius (33)
Annotations\RadiusCloudProvidersAnnotation.cs (1)
29internal static RadiusCloudProvidersAnnotation GetOrAdd(IResource resource)
Annotations\RadiusRecipeParametersAnnotation.cs (1)
35internal static RadiusRecipeParametersAnnotation GetOrAdd(IResource resource)
Annotations\RadiusSecretStoresAnnotation.cs (1)
27internal static RadiusSecretStoresAnnotation GetOrAdd(IResource resource)
Publishing\RadiusInfrastructureBuilder.cs (23)
141foreach (var resource in radiusResources) 248foreach (var resource in radiusResources) 277foreach (var resource in computeResources) 628private (string ResourceType, string ApiVersion) ResolveResourceType(IResource resource) 633private (List<IResource> radiusResources, List<IResource> computeResources, Dictionary<IResource, (string ResourceType, string ApiVersion)> resolvedTypes) ClassifyResources() 635var radiusTypes = new List<IResource>(); 636var compute = new List<IResource>(); 637var resolved = new Dictionary<IResource, (string ResourceType, string ApiVersion)>(); 640foreach (var resource in _model.Resources) 656var resolvedResource = ResolveToParent(resource); 693private bool IsTargetedToThisEnvironment(IResource resource) 712private static IResource ResolveToParent(IResource resource) 945private static string GetContainerImage(IResource resource) 989IResource resource, 990List<IResource> radiusResources, 1002var referencedResource = reference.Resource; 1063private static Dictionary<string, ContainerPortConstruct> ResolvePorts(IResource resource) 1114private async Task<Dictionary<string, ContainerEnvVarConstruct>> ResolveEnvironmentAsync(IResource resource) 1187private async Task ResolveEnvPartsAsync(object? value, IResource owner, List<EnvPart> parts) 1244private async Task ResolveReferenceExpressionPartsAsync(ReferenceExpression expression, IResource owner, List<EnvPart> parts)
Publishing\RadiusServiceDiscovery.cs (2)
46public static string GetServiceName(IResource resource) => GetServiceName(resource.Name); 91public static int? ResolveServicePort(IResource resource, string endpointName)
RadiusInfrastructure.cs (1)
71foreach (var resource in context.Model.GetComputeResources())
ResourceMapping\ResourceTypeMapper.cs (3)
129public (string ResourceType, string ApiVersion) MapResource(IResource resource) 178internal static bool IsBackingResource(IResource resource) 190private static string GetMappingKey(IResource resource)
Secrets\RadiusSecretStoreValidation.cs (1)
226foreach (var resource in model.Resources)
Aspire.Hosting.Radius.Tests (13)
InnerLoop\GracefulDegradationTests.cs (3)
35var apiResource = model.Resources.First(r => r.Name == "api"); 68foreach (var resource in model.GetComputeResources()) 90var apiResource = model.Resources.First(r => r.Name == "api");
InnerLoop\MultiEnvironmentTests.cs (2)
67var apiResource = model.Resources.First(r => r.Name == "api"); 96var apiResource = model.Resources.First(r => r.Name == "api");
InnerLoop\RadiusInfrastructureInitializationTests.cs (5)
29var apiResource = model.Resources.First(r => r.Name == "api"); 49foreach (var resource in model.GetComputeResources()) 68var paramResource = model.Resources.First(r => r.Name == "my-param"); 86var apiResource = model.Resources.First(r => r.Name == "api"); 103var projectResource = model.Resources.First(r => r.Name == "webapp");
Publishing\RadCredentialArgumentTests.cs (1)
105private static async Task<IReadOnlyList<string>> ResolveSingleAsync(IResource resource)
RadiusEnvironmentResourceTests.cs (1)
54Assert.IsAssignableFrom<IResource>(resource);
RadiusTestHelper.cs (1)
39foreach (var resource in model.GetComputeResources())
Aspire.Hosting.Redis (2)
RedisBuilderExtensions.cs (2)
32/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 56/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Redis.Tests (4)
AddRedisTests.cs (4)
264var redisinsight = builder.Resources.Single(r => r.Name.Equals("redisinsight")); 488var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 514var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 535var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander"));
Aspire.Hosting.RemoteHost.Tests (6)
AtsContextFilterTests.cs (1)
392ClrType = typeof(IResourceBuilder<IResource>),
AttributeDataReaderTests.cs (4)
201public static void OfficialExportMethod(IResource resource) 207public static void OverriddenNameMethod(IResource resource) 220public static void ObsoleteExportMethod(IResource resource) 303[typeof(IResource)]);
CapabilityDispatcherTests.cs (1)
2621internal sealed class TestResourceBuilder<T> : IResourceBuilder<T> where T : IResource
Aspire.Hosting.Rust.Tests (1)
AddRustAppPublishTests.cs (1)
340private static PipelineStep CreateBuildComputeStep(string name, IResource resource)
Aspire.Hosting.SqlServer (1)
SqlServerBuilderExtensions.cs (1)
108/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Testing (11)
DistributedApplicationHostingTestingExtensions.cs (5)
92if (!applicationModel.Resources.TryGetByName(DashboardResourceName, out var resource) || 176var resource = GetResource(app, resourceName); 252static IResource GetResource(DistributedApplication app, string resourceName) 257if (!applicationModel.Resources.TryGetByName(resourceName, out var resource)) 267var resource = GetResource(app, resourceName);
DistributedApplicationTestingBuilder.cs (6)
536public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => innerBuilder.AddResource(resource); 546public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => innerBuilder.CreateResourceBuilder(resource); 699public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => _innerBuilder.AddResource(resource); 713public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => _innerBuilder.CreateResourceBuilder(resource); 796new IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).AddResource(resource); 799new IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).CreateResourceBuilder(resource);
Aspire.Hosting.Testing.Tests (3)
TestingBuilderTests.cs (1)
108foreach (var resource in appModel.GetContainerResources())
tests\Aspire.Hosting.TestUtilities\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)
33public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
Aspire.Hosting.Tests (125)
ApplicationModel\Docker\DockerfileBuilderCallbackContextTests.cs (1)
135Assert.IsAssignableFrom<IResource>(context.Resource);
ApplicationModel\ResourceCollectionTests.cs (13)
17var found = collection.TryGetByName("myResource", out var result); 30var found = collection.TryGetByName("MYRESOURCE", out var result); 42var found = collection.TryGetByName("missing", out var result); 53var found = collection.TryGetByName("anything", out var result); 122Assert.True(collection.TryGetByName("res2", out var result)); 136Assert.True(collection.TryGetByName("new", out var result)); 190Assert.True(collection.TryGetByName("res", out var result)); 197var resources = new IResource[] 209var resources = new IResource[] 216Assert.True(collection.TryGetByName("res1", out var r1)); 219Assert.True(collection.TryGetByName("res2", out var r2)); 232Assert.True(collection.TryGetByName("test", out var result)); 248private sealed class SimpleResourceCollection : Collection<IResource>, IResourceCollection
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (2)
1199private static async Task PrimeEnvironmentCallbackCacheAsync(IResource resource, IServiceProvider services) 2163var dashboard = Assert.Single(model.Resources, r => r.Name == KnownResourceNames.AspireDashboard);
Dashboard\DashboardEventHandlersTests.cs (9)
53var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 102var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 194var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 451var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 534var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 608var dashboardResource = Assert.Single(model.Resources); 691var dashboardResource = Assert.Single(model.Resources); 760var dashboardResource = Assert.Single(model.Resources); 827var dashboardResource = Assert.Single(model.Resources);
Dashboard\DashboardResourceTests.cs (16)
113var dashboard = Assert.Single(model.Resources); 209var dashboard = Assert.Single(model.Resources); 243var dashboard = Assert.Single(model.Resources); 286var dashboard = Assert.Single(model.Resources); 314var dashboard = Assert.Single(model.Resources); 383var dashboard = Assert.Single(model.Resources); 423var dashboard = Assert.Single(model.Resources); 459var dashboard = Assert.Single(model.Resources); 498var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 502var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 544var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 548var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 592var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 624var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 826var dashboard = Assert.Single(model.Resources); 858static void SetDashboardAllocatedEndpoints(IResource dashboard, int otlpGrpcPort, int otlpHttpPort, int httpPort, int httpsPort)
Dcp\DcpExecutorTests.cs (18)
3751var connectionStringAvailableChannel = Channel.CreateUnbounded<IResource>(); 3796var connectionStringAvailableResource = await connectionStringAvailableChannel.Reader.ReadAsync().AsTask().DefaultTimeout(); 3826var connectionStringAvailableChannel = Channel.CreateUnbounded<IResource>(); 3844var connectionStringAvailableResource = await connectionStringAvailableChannel.Reader.ReadAsync().AsTask().DefaultTimeout(); 5029var failedResources = new List<IResource>(); 6608var failedResources = new ConcurrentQueue<IResource>(); 7472var failedResources = new List<IResource>(); 7988var failedResources = new List<IResource>(); 8320var failedResources = new List<IResource>(); 8490var failedResources = new List<(IResource Resource, string? ErrorMessage)>(); 8566var failedResources = new ConcurrentQueue<(IResource Resource, string? ErrorMessage)>(); 8761var failedResources = new List<(IResource Resource, string? ErrorMessage)>(); 9602private static void HasKnownCommandAnnotations(IResource resource) 9611private static void HasKnownProjectCommandAnnotations(IResource resource) 9663var failedResources = new List<IResource>(); 9754var failedResources = new List<IResource>(); 10425private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 10427public IResource Parent => parent;
Dcp\ExecutableLaunchPlanTests.cs (1)
231IResource resource,
Dcp\ResourceSnapshotBuilderTests.cs (6)
76var snapshot = CreateSnapshotBuilder(new Dictionary<string, IResource> 102var snapshotBuilder = CreateSnapshotBuilder(new Dictionary<string, IResource> 141CreateSnapshotBuilder(new Dictionary<string, IResource> 169var snapshotBuilder = CreateSnapshotBuilder(new Dictionary<string, IResource> 288private static DcpResourceSnapshotBuilder CreateSnapshotBuilder(IDictionary<string, IResource>? applicationModel = null) 290return new(new DcpResourceState(applicationModel ?? new Dictionary<string, IResource>(), []));
DebugSupportExtensionsTests.cs (5)
49parameters[0].ParameterType == typeof(IResource) && 60parameters[0].ParameterType == typeof(IResource) && 72[typeof(IResource), typeof(string), typeof(CancellationToken)]); 459private static string GetProjectPath(IResource resource) => resource.Annotations.OfType<IProjectMetadata>().Last().ProjectPath; 462IResource resource,
DistributedApplicationBuilderTests.cs (1)
76var resource = Assert.Single(appModel.Resources);
DistributedApplicationTests.cs (1)
1353var aspireDashboard = model.Resources.Single(r => r.Name == KnownResourceNames.AspireDashboard);
Eventing\DistributedApplicationBuilderEventingTests.cs (2)
301var resourceStopped = default(IResource);
Lifecycle\TerminalHostFailureDiagnosticServiceTests.cs (4)
248private static async Task WaitForUnhideAsync(ResourceNotificationService notifications, IResource host) 259private static async Task<CustomResourceSnapshot> ReadCurrentSnapshotAsync(ResourceNotificationService notifications, IResource host) 271private static async Task<IReadOnlyList<LogLine>> ReadLogsAsync(ResourceLoggerService loggers, IResource host, int expected, int? timeoutMs = null) 295private static async Task<bool> TryReadAnyLogAsync(ResourceLoggerService loggers, IResource host)
Orchestrator\ApplicationOrchestratorTests.cs (4)
1068private static async Task PublishReplicaStatesAsync(ResourceNotificationService notificationService, IResource resource, string state) 1193private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 1195public IResource Parent => parent; 1249public IResource Parent { get; } = parent;
Orchestrator\ParameterProcessorTests.cs (1)
86var updates = new List<(IResource Resource, CustomResourceSnapshot Snapshot)>();
Orchestrator\RelationshipEvaluatorTests.cs (2)
139private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 141public IResource Parent => parent;
Pipelines\DistributedApplicationPipelineTests.cs (6)
996IResource? capturedResource = null; 1544IResource? targetResource = null; 1573var resource2Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource2"); 1613var resource1Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource1"); 1674IResource? capturedResource = null; 2413var transient = model.Resources.Single(r => r.Name == "transient-resource");
ProjectResourceTests.cs (1)
943var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
Publishing\ResourceContainerImageManagerTests.cs (2)
1295IResource? capturedResource = null; 1569private static void AssertImageArchiveWasWritten(IResource resource, string outputPath)
RequiredCommandAnnotationTests.cs (17)
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"); 336var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 337var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 371var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 372var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 396var resource = appModel.Resources.Single(r => r.Name == "test"); 428var resource = appModel.Resources.Single(r => r.Name == "test"); 453var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 454var resource2 = appModel.Resources.Single(r => r.Name == "test2");
ResourceDependencyTests.cs (2)
830Array.Empty<IResource>(), executionContext); 1017foreach (var dep in singleDeps)
ResourceFailureLoggingTests.cs (1)
74where T : IResource
ResourceNotificationTests.cs (2)
62IResource resource = resourceType.Name switch 1412int? exitCode = default) where T : IResource
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
125IResource resource,
tests\Shared\ConsoleLogging\ConsoleLoggingTestHelpers.cs (1)
33public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
WithEnvironmentTests.cs (2)
483private readonly IResource _referencedResource; 485public TestValueWithReferences(string value, IResource referencedResource)
WithHttpCommandTests.cs (1)
1057private static async Task MoveResourceToRunningStateAsync(DistributedApplication app, IResource resource, string commandName = "mycommand")
WithOtlpExporterTests.cs (1)
230foreach (var resource in appModel.Resources)
WithReferenceTests.cs (2)
262ResourceBuilderExtensions.WithReference(projectB, (IResourceBuilder<IResource>)resource, connectionName: "db", name: "api"); 284ResourceBuilderExtensions.WithReference(projectB, (IResourceBuilder<IResource>)resource, connectionName: "db");
Aspire.Hosting.TestUtilities (20)
MockImageBuilder.cs (6)
19public ConcurrentBag<IResource> BuildImageResources { get; } = []; 21public ConcurrentBag<IResource> PushImageCalls { get; } = []; 23public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 30public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 33foreach (var resource in resources) 40public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\FakeContainerRuntime.cs (2)
28public ConcurrentBag<IResource> PushImageCalls { get; } = []; 65public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Utils\ArgumentEvaluator.cs (1)
11public static async ValueTask<List<string>> GetArgumentListAsync(IResource resource, IServiceProvider? serviceProvider = null)
Utils\EnvironmentVariableEvaluator.cs (1)
12IResource resource,
Utils\LaunchConfigurationTestHelpers.cs (2)
11IResource resource, 26IResource 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) 66public static async Task<JsonNode[]> GetManifests(IResource[] resources) 79foreach (var r in resources)
Utils\TestDcpExecutor.cs (3)
28public void AddResource(IResource modelResource, string dcpResourceName) 52private sealed class TestResourceReference(IResource modelResource, string dcpResourceName) : IResourceReference 54public IResource ModelResource { get; } = modelResource;
Aspire.Hosting.Yarp (1)
YarpResourceExtensions.cs (1)
262private 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.TestUtilities\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 (13)
AppHost.cs (2)
44IResource parent = rb.Resource; 131IResourceBuilder<IResource>? previousResourceBuilder = null;
CommandResources.cs (1)
1413foreach (var r in resources)
InteractionCommands.cs (1)
14public static IResourceBuilder<T> AddInteractionCommands<T>(this IResourceBuilder<T> resource) where T : IResource
TestResource.cs (9)
33public static IResourceBuilder<TestNestedResource> AddNestedResource(this IDistributedApplicationBuilder builder, string name, IResource parent) 52public static IResourceBuilder<CommandGroupResource> AddCommandGroup(this IDistributedApplicationBuilder builder, string name, IResource parent) 69public static IResourceBuilder<HttpCommandGroupResource> AddHttpCommandGroup(this IDistributedApplicationBuilder builder, string name, IResource parent) 211sealed class TestNestedResource(string name, IResource parent) : Resource(name), IResourceWithParent 213public IResource Parent { get; } = parent; 216sealed class CommandGroupResource(string name, IResource parent) : Resource(name), IResourceWithParent 218public IResource Parent { get; } = parent; 221sealed class HttpCommandGroupResource(string name, IResource parent) : Resource(name), IResourceWithParent, IResourceWithEndpoints 223public IResource Parent { get; } = parent;