24 interfaces inheriting from IResource
Aspire.Hosting (14)
ApplicationModel\IComputeEnvironmentResource.cs (1)
11public interface IComputeEnvironmentResource : IResource
ApplicationModel\IComputeResource.cs (1)
13public interface IComputeResource : IResource
ApplicationModel\IContainerFilesDestinationResource.cs (1)
15public interface IContainerFilesDestinationResource : IResource
ApplicationModel\IResourceWithArgs.cs (1)
9public interface IResourceWithArgs : IResource
ApplicationModel\IResourceWithConnectionString.cs (1)
9public interface IResourceWithConnectionString : IResource, IManifestExpressionProvider, IValueProvider, IValueWithReferences
ApplicationModel\IResourceWithContainerFiles.cs (1)
15public interface IResourceWithContainerFiles : IResource
ApplicationModel\IResourceWithCustomWithReference.cs (1)
18public 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 (5)
IAzureDelegatedSubnetResource.cs (1)
13public interface IAzureDelegatedSubnetResource : IResource
IAzureKeyVaultResource.cs (1)
12public interface IAzureKeyVaultResource : IResource, IAzureResource
IAzurePrivateEndpointTarget.cs (1)
13public interface IAzurePrivateEndpointTarget : IResource
IAzureResource.cs (1)
11public interface IAzureResource : IResource
IResourceWithAzureFunctionsConfig.cs (1)
11public interface IResourceWithAzureFunctionsConfig : IResource
Aspire.Hosting.CodeGeneration.Go.Tests (1)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Java.Tests (1)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Python.Tests (1)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.Rust.Tests (1)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestRedisResource.cs (1)
38public interface ITestVaultResource : IResource
Aspire.Hosting.CodeGeneration.TypeScript.Tests (1)
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)
350private sealed class TestResource : IResource
DistributedApplicationModelExtensionsTests.cs (1)
71private sealed class CustomResource : IResource
Eventing\DistributedApplicationBuilderEventingTests.cs (1)
343private sealed class TestResource(string name) : IResource
Utils\VolumeNameGeneratorTests.cs (1)
47private sealed class TestResource(string name) : IResource
1010 references to IResource
Aspire.Hosting (483)
ApplicationModel\ArgumentsExecutionConfigurationGatherer.cs (1)
14public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
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)
31public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\CommandLineArgsCallbackAnnotation.cs (3)
54private readonly IResource? _resource; 62public CommandLineArgsCallbackContext(IList<object> args, IResource resource, CancellationToken cancellationToken = default) 92public IResource Resource => _resource ?? throw new InvalidOperationException($"{nameof(Resource)} is not set. This callback context is not associated with a resource.");
ApplicationModel\CommandsConfigurationExtensions.cs (1)
15internal static void AddLifeCycleCommands(this IResource resource)
ApplicationModel\ConnectionStringAvailableEvent.cs (3)
11/// <param name="resource">The <see cref="IResource"/> for the event.</param> 14public class ConnectionStringAvailableEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 17public IResource Resource => resource;
ApplicationModel\ContainerBuildOptionsCallbackAnnotation.cs (2)
51IResource resource, 67public IResource Resource { get; }
ApplicationModel\ContainerFilesDestinationAnnotation.cs (1)
20public required IResource Source { get; init; }
ApplicationModel\ContainerFileSystemCallbackAnnotation.cs (1)
279public required IResource Model { get; init; }
ApplicationModel\ContainerImagePushOptionsCallbackContext.cs (1)
26public required IResource Resource { get; init; }
ApplicationModel\ContainerImageReference.cs (2)
21public ContainerImageReference(IResource resource) 29public IResource Resource { get; }
ApplicationModel\ContainerPortReference.cs (2)
12public class ContainerPortReference(IResource resource) : IManifestExpressionProvider, IValueWithReferences, IValueProvider 17public IResource Resource { get; } = resource;
ApplicationModel\CustomResourceSnapshot.cs (1)
438public static ImmutableArray<RelationshipSnapshot> BuildRelationships(IResource resource)
ApplicationModel\DeploymentTargetAnnotation.cs (2)
9public sealed class DeploymentTargetAnnotation(IResource target) : IResourceAnnotation 14public IResource DeploymentTarget { get; set; } = target;
ApplicationModel\DistributedApplicationModel.cs (1)
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> 17public static IEnumerable<IResource> GetComputeResources(this DistributedApplicationModel model) 19foreach (var r in model.Resources) 45/// <returns>An enumerable of build <see cref="IResource"/> in the model.</returns> 46public static IEnumerable<IResource> GetBuildResources(this DistributedApplicationModel model) 48foreach (var r in model.Resources) 62/// <returns>An enumerable of build and push <see cref="IResource"/> in the model.</returns> 63public static IEnumerable<IResource> GetBuildAndPushResources(this DistributedApplicationModel model) 65foreach (var r in model.Resources)
ApplicationModel\Docker\ContainerFilesExtensions.cs (6)
23public static DockerfileBuilder AddContainerFilesStages(this DockerfileBuilder builder, IResource resource, ILogger? logger) 32var source = containerFileDestination.Source; 80public static DockerfileStage AddContainerFiles(this DockerfileStage stage, IResource resource, string rootDestinationPath, ILogger? logger) 90var source = containerFileDestination.Source; 121private static string GetSourceImageArgName(IResource source) => $"{source.Name.Replace("-", "_").ToUpperInvariant()}_IMAGENAME"; 124private static string GetSourceStageName(IResource source) => $"{source.Name.Replace("-", "_")}_stage";
ApplicationModel\DockerfileBuilderCallbackContext.cs (2)
22public DockerfileBuilderCallbackContext(IResource resource, DockerfileBuilder builder, IServiceProvider services, CancellationToken cancellationToken) 33public IResource Resource { get; }
ApplicationModel\DockerfileFactoryContext.cs (1)
37public required IResource Resource { get; init; }
ApplicationModel\EnvironmentCallbackContext.cs (3)
18private readonly IResource? _resource; 27public EnvironmentCallbackContext(DistributedApplicationExecutionContext executionContext, IResource resource, Dictionary<string, object>? environmentVariables = null, CancellationToken cancellationToken = default) 56public IResource Resource => _resource ?? throw new InvalidOperationException($"{nameof(Resource)} is not set. This callback context is not associated with a resource.");
ApplicationModel\EnvironmentVariablesConfigurationGatherer.cs (1)
14public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\ExecutionConfigurationBuilder.cs (3)
40private readonly IResource _resource; 43private ExecutionConfigurationBuilder(IResource resource) 79public static IExecutionConfigurationBuilder Create(IResource resource)
ApplicationModel\ExecutionConfigurationGathererContext.cs (1)
38IResource resource,
ApplicationModel\HttpsCertificateConfigurationCallbackAnnotaion.cs (1)
35public required IResource Resource { get; init; }
ApplicationModel\HttpsCertificateExecutionConfigurationGatherer.cs (1)
30public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
ApplicationModel\HttpsEndpointUpdateCallbackContext.cs (2)
21/// Gets the <see cref="IResource"/> that is being configured for HTTPS. 23public 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 (1)
9public interface IResourceCollection : IList<IResource>
ApplicationModel\IResourceWithCustomWithReference.cs (2)
19where TSelf : IResource, IResourceWithCustomWithReference<TSelf> 33IResourceBuilder<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\ReferenceExpression.cs (5)
414where T : IResource, IValueProvider, IManifestExpressionProvider 426where T : IResource, IValueProvider, IManifestExpressionProvider 593var unwrapped = valueProvider is IResourceBuilder<IResource> rb ? rb.Resource : valueProvider; 698where T : IResource, IValueProvider, IManifestExpressionProvider 710where T : IResource, IValueProvider, IManifestExpressionProvider
ApplicationModel\RequiredCommandValidator.cs (1)
51IResource resource,
ApplicationModel\Resource.cs (1)
9/// Represents an abstract resource that can be used by an application, that implements <see cref="IResource"/>.
ApplicationModel\ResourceAnnotationMutationBehavior.cs (1)
8/// method when adding an annotation to the <see cref="IResource.Annotations"/> collection of a resource.
ApplicationModel\ResourceCollection.cs (11)
13private readonly List<IResource> _resources = []; 17public ResourceCollection(IEnumerable<IResource> resources) => _resources.AddRange(resources); 19public IResource this[int index] { get => _resources[index]; set => _resources[index] = value; } 22public void Add(IResource item) => _resources.Add(item); 24public bool Contains(IResource item) => _resources.Contains(item); 25public void CopyTo(IResource[] array, int arrayIndex) => _resources.CopyTo(array, arrayIndex); 26public IEnumerator<IResource> GetEnumerator() => _resources.GetEnumerator(); 27public int IndexOf(IResource item) => _resources.IndexOf(item); 28public void Insert(int index, IResource item) => _resources.Insert(index, item); 29public bool Remove(IResource item) => _resources.Remove(item); 42public required IResource Resource { get; init; }
ApplicationModel\ResourceCommandService.cs (2)
72public async Task<ExecuteCommandResult> ExecuteCommandAsync(IResource resource, string commandName, CancellationToken cancellationToken = default) 130internal async Task<ExecuteCommandResult> ExecuteCommandCoreAsync(string resourceId, IResource resource, string commandName, CancellationToken cancellationToken)
ApplicationModel\ResourceEndpointsAllocatedEvent.cs (2)
15public class ResourceEndpointsAllocatedEvent(IResource resource, IServiceProvider services) : IDistributedApplicationResourceEvent 18public IResource Resource { get; } = resource;
ApplicationModel\ResourceExtensions.cs (76)
16/// Provides extension methods for the <see cref="IResource"/> interface. 27public static bool TryGetLastAnnotation<T>(this IResource resource, [NotNullWhen(true)] out T? annotation) where T : IResourceAnnotation 48public static bool TryGetAnnotationsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 70public static bool HasAnnotationOfType<T>(this IResource resource) where T : IResourceAnnotation 82public static bool TryGetAnnotationsIncludingAncestorsOfType<T>(this IResource resource, [NotNullWhen(true)] out IEnumerable<T>? result) where T : IResourceAnnotation 119public static bool HasAnnotationIncludingAncestorsOfType<T>(this IResource resource) where T : IResourceAnnotation 152public static bool TryGetEnvironmentVariables(this IResource resource, [NotNullWhen(true)] out IEnumerable<EnvironmentCallbackAnnotation>? environmentVariables) 258this IResource resource, 293this IResource resource, 333this IResource resource, 356this IResource resource, 390this IResource resource, 426this IResource resource, 448this IResource resource, 485where T : IResource, IComputeResource 506where T : IResource, IComputeResource 514internal static NetworkIdentifier GetDefaultResourceNetwork(this IResource resource) 519internal static IEnumerable<NetworkIdentifier> GetSupportedNetworks(this IResource resource) 525this IResource resource, 536(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await resource.GetValue(executionContext, key, provider, logger, cancellationToken).ConfigureAwait(false), 538(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false), 548public static bool IsExcludedFromPublish(this IResource resource) => 552this IResource resource, 595private static async Task<ResolvedValue?> GetValue(this IResource resource, DistributedApplicationExecutionContext executionContext, string? key, IValueProvider valueProvider, ILogger logger, CancellationToken cancellationToken) 601if (valueProvider is IResource providerResource) 658public static bool TryGetContainerMounts(this IResource resource, [NotNullWhen(true)] out IEnumerable<ContainerMountAnnotation>? volumeMounts) 669public static bool TryGetEndpoints(this IResource resource, [NotNullWhen(true)] out IEnumerable<EndpointAnnotation>? endpoints) 680public static bool TryGetUrls(this IResource resource, [NotNullWhen(true)] out IEnumerable<ResourceUrlAnnotation>? urls) 689/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 705/// <returns>An enumeration of <see cref="EndpointReference"/> based on the <see cref="EndpointAnnotation"/> annotations from the resources' <see cref="IResource.Annotations"/> collection.</returns> 768public static IReadOnlyList<ResolvedEndpoint> ResolveEndpoints(this IResource resource, IPortAllocator? portAllocator = null) 851public static bool TryGetContainerImageName(this IResource resource, [NotNullWhen(true)] out string? imageName) 863public static bool TryGetContainerImageName(this IResource resource, bool useBuiltImage, [NotNullWhen(true)] out string? imageName) 904public static int GetReplicaCount(this IResource resource) 925public static bool RequiresImageBuild(this IResource resource) 945public static bool RequiresImageBuildAndPush(this IResource resource) 950internal static bool IsBuildOnlyContainer(this IResource resource) 961public static IComputeEnvironmentResource? GetComputeEnvironment(this IResource resource) 974public static DeploymentTargetAnnotation? GetDeploymentTargetAnnotation(this IResource resource, IComputeEnvironmentResource? targetComputeEnvironment = null) 1019internal static ContainerLifetime GetContainerLifetimeType(this IResource resource) 1035internal static bool TryGetContainerImagePullPolicy(this IResource resource, [NotNullWhen(true)] out ImagePullPolicy? pullPolicy) 1053internal static bool SupportsProxy(this IResource resource) 1063internal static IResource GetRootResource(this IResource resource) => 1074internal static string GetResolvedResourceName(this IResource resource) 1095internal static bool TryGetInstances(this IResource resource, out ImmutableArray<DcpInstance> instances) 1112internal static string[] GetResolvedResourceNames(this IResource resource) 1132this IResource resource, 1172internal static IContainerRegistry GetContainerRegistry(this IResource resource) 1197var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 1219this IResource resource, 1248internal static ILogger GetLogger(this IResource resource, IServiceProvider serviceProvider) 1281public static Task<IReadOnlySet<IResource>> GetResourceDependenciesAsync( 1282this IResource resource, 1317internal static async Task<IReadOnlySet<IResource>> GetDependenciesAsync( 1318IEnumerable<IResource> resources, 1323var dependencies = new HashSet<IResource>(); 1324var newDependencies = new HashSet<IResource>(); 1325var toProcess = new Queue<IResource>(); 1327foreach (var resource in resources) 1336foreach(var nd in newDependencies) 1343var dep = toProcess.Dequeue(); 1348foreach (var newDep in newDependencies) 1360foreach (var resource in resources) 1377IResource resource, 1378HashSet<IResource> dependencies, 1379HashSet<IResource> newDependencies, 1401IResource resource, 1445private static void CollectAnnotationDependencies(IResource resource, HashSet<IResource> dependencies, HashSet<IResource> newDependencies) 1481private static void CollectDependenciesFromValue(object? value, HashSet<IResource> dependencies, HashSet<IResource> newDependencies, HashSet<object> visitedValues) 1489if (value is IResource resource) 1498if (value is IResourceBuilder<IResource> resourceBuilder) 1521internal static string GetResourceType(this IResource resource) => resource switch
ApplicationModel\ResourceLoggerService.cs (5)
49public ILogger GetLogger(IResource resource) 157public IAsyncEnumerable<IReadOnlyList<LogLine>> GetAllAsync(IResource resource) 177public IAsyncEnumerable<IReadOnlyList<LogLine>> WatchAsync(IResource resource) 270/// <param name="resource">The <see cref="IResource"/>.</param> 271public void Complete(IResource resource)
ApplicationModel\ResourceNotificationService.cs (19)
139private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken) 266private async Task WaitUntilCompletionAsync(IResource resource, IResource dependency, int exitCode, CancellationToken cancellationToken) 334private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, 415private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken) 433public async Task WaitForDependenciesAsync(IResource resource, CancellationToken cancellationToken) 638public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 738private CustomResourceSnapshot UpdateCommands(IResource resource, CustomResourceSnapshot previousState) 812private static CustomResourceSnapshot UpdateIcons(IResource resource, CustomResourceSnapshot previousState) 842public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 851private static CustomResourceSnapshot GetCurrentSnapshot(IResource resource, ResourceNotificationState notificationState) 879private ResourceNotificationState GetResourceNotificationState(string resourceId, IResource resource) => 955private sealed class ResourceNotificationState(IResource resource) 960public IResource Resource { get; } = resource; 987public class ResourceEvent(IResource resource, string resourceId, CustomResourceSnapshot snapshot) 992public 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) 22public IResource Resource { get; } = resource;
ApplicationModel\WaitAnnotation.cs (2)
18public sealed class WaitAnnotation(IResource resource, WaitType waitType, int exitCode = 0) : IResourceAnnotation 23public IResource Resource { get; } = resource;
Ats\AtsTypeMappings.cs (1)
33[assembly: AspireExport(typeof(IResource))]
Ats\CoreExports.cs (1)
104public static string GetResourceName(this IResourceBuilder<IResource> resource)
Ats\EventingExports.cs (4)
36where T : IResource 52where T : IResource 84where T : IResource 116where T : IResource
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\UserSecretsExports.cs (1)
58where T : IResource
Backchannel\AuxiliaryBackchannelRpcTarget.cs (4)
446foreach (var resource in appModel.Resources) 506var resource = resourceEvent.Resource; 664var resource = appModel.Resources.FirstOrDefault(r => string.Equals(r.Name, resourceName, StringComparisons.ResourceName)); 675foreach (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)
125foreach (var resource in beforeStartEvent.Model.Resources) 160where TDestination : IResource 161where TContainerRegistry : IResource, IContainerRegistry
ContainerResourceBuilderExtensions.cs (1)
1581public static IResourceBuilder<T> WithDockerfileBaseImage<T>(this IResourceBuilder<T> builder, string? buildImage = null, string? runtimeImage = null) where T : IResource
ContainerResourceExtensions.cs (3)
18public static IEnumerable<IResource> GetContainerResources(this DistributedApplicationModel model) 22foreach (var resource in model.Resources) 36public static bool IsContainer(this IResource resource)
CustomResourceExtensions.cs (1)
23where TResource : IResource
Dashboard\DashboardEventHandlers.cs (1)
347private void ConfigureAspireDashboardResource(IResource dashboardResource)
Dashboard\DashboardServiceData.cs (1)
40static GenericResourceSnapshot CreateResourceSnapshot(IResource resource, string resourceId, DateTime creationTimestamp, CustomResourceSnapshot snapshot)
Dashboard\ResourcePublisher.cs (3)
19private sealed record SourceAndResourceSnapshot(IResource Source, ResourceSnapshot Snapshot); 28internal bool TryGetResource(string resourceName, [NotNullWhen(returnValue: true)] out ResourceSnapshot? snapshot, [NotNullWhen(returnValue: true)] out IResource? resource) 84internal async ValueTask IntegrateAsync(IResource source, ResourceSnapshot snapshot, ResourceSnapshotChangeType changeType)
Dcp\AppResource.cs (4)
53public IResource ModelResource { get; } 55public RenderedModelResource(IResource modelResource, CustomResource dcpResource): base(dcpResource) 78public ServiceWithModelResource(IResource modelResource, Service service, EndpointAnnotation sba) : base(modelResource, service) 86IResource ModelResource { get; }
Dcp\DcpExecutor.cs (17)
503_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource)) 608private static string GetResourceType<T>(T resource, IResource appModelResource) where T : CustomResource 800_resourceState.ApplicationModel.TryGetValue(appModelResourceName, out var appModelResource)) 1556private void EnsureRequiredAnnotations(IResource resource) 1564private static void SetInitialResourceState(IResource resource, IAnnotationHolder annotationHolder) 1596var groupKey = group.Key; 1611IResource resource, 1969foreach (var container in modelContainerResources) 2035private static DcpInstance GetDcpInstance(IResource resource, int instanceIndex) 2125var modelContainerResource = cr.ModelResource; 2365private static async Task ApplyBuildArgumentsAsync(Container dcpContainerResource, IResource modelContainerResource, IServiceProvider serviceProvider, CancellationToken cancellationToken) 2446private void AddServicesProducedInfo(IResource modelResource, IAnnotationHolder dcpResource, RenderedModelResource appResource) 2745public required IResource Resource { get; init; } 2788private async Task<(List<string>, bool)> BuildRunArgsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken) 3011private static List<VolumeMount> BuildContainerMounts(IResource container) 3034private static bool TryGetEndpoint(IResource resource, string? endpointName, [NotNullWhen(true)] out EndpointAnnotation? endpoint) 3050private static HostResourceWithEndpoints? AsHostResourceWithEndpoints(IResource resource)
Dcp\DcpExecutorEvents.cs (3)
11internal record OnResourceStartingContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName); 13internal record OnResourceChangedContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string DcpResourceName, ResourceStatus Status, Func<CustomResourceSnapshot, CustomResourceSnapshot> UpdateSnapshot); 14internal record OnResourceFailedToStartContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string? DcpResourceName);
Dcp\DcpHost.cs (1)
552private static bool ResourceUsesTls(IResource resource)
Dcp\DcpNameGenerator.cs (6)
28public void EnsureDcpInstancesPopulated(IResource resource) 58private static void AddInstancesAnnotation(IResource resource, ImmutableArray<DcpInstance> instances) 63public (string Name, string Suffix) GetContainerName(IResource container) 74public (string Name, string Suffix) GetExecutableName(IResource project) 80public string GetServiceName(IResource resource, EndpointAnnotation endpoint, bool hasMultipleEndpoints, HashSet<string> allServiceNames) 122public static string GetObjectNameForResource(IResource resource, DcpOptions options, string suffix = "")
Dcp\DcpResourceState.cs (2)
10internal sealed class DcpResourceState(Dictionary<string, IResource> applicationModel, List<AppResource> appResources) 19public Dictionary<string, IResource> ApplicationModel { get; } = applicationModel;
Dcp\OtlpEndpointReferenceGatherer.cs (1)
22public async ValueTask GatherAsync(IExecutionConfigurationGathererContext context, IResource resource, ILogger resourceLogger, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken = default)
Dcp\ResourceSnapshotBuilder.cs (4)
39_resourceState.ApplicationModel.TryGetValue(container.AppModelResourceName, out var appModelResource)) 96IResource? appModelResource = null; 132IResource? appModelResource = null; 237_resourceState.ApplicationModel.TryGetValue(resourceName, out var appModelResource) &&
DistributedApplication.cs (2)
612foreach (var resource in app._model.Resources) 628public required IResource Resource { get; init; }
DistributedApplicationBuilder.cs (2)
759public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource 773public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource
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)
24where T : IResource 37where T : IResource 63where T : IResource 89where T : IResource 93where TResource : IResource
DistributedApplicationResourceBuilder.cs (1)
8internal sealed class DistributedApplicationResourceBuilder<T>(IDistributedApplicationBuilder applicationBuilder, T resource) : IResourceBuilder<T> where T : IResource
EmulatorResourceExtensions.cs (1)
18public static bool IsEmulator(this IResource resource)
Eventing\DistributedApplicationEventing.cs (1)
106public DistributedApplicationEventSubscription Subscribe<T>(IResource resource, Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationResourceEvent
Eventing\DistributedApplicationEventSubscription.cs (2)
25public class DistributedApplicationResourceEventSubscription(IResource? resource, Func<IDistributedApplicationResourceEvent, CancellationToken, Task> callback) 31public IResource? Resource { get; } = resource;
Eventing\IDistributedApplicationEvent.cs (1)
27IResource Resource { get; }
Eventing\IDistributedApplicationEventing.cs (1)
29DistributedApplicationEventSubscription Subscribe<T>(IResource resource, Func<T, CancellationToken, Task> callback) where T : IDistributedApplicationResourceEvent;
Exec\ExecEventingHandlers.cs (1)
14var resource = execResourceManager.CreateExecResource();
Exec\ExecResourceManager.cs (9)
23private readonly TaskCompletionSource<IResource> _execResourceInitialized = new(); 57IResource? execResource = null; 156public IResource? CreateExecResource() 165var targetResource = _model.Resources.FirstOrDefault(x => x.Name.Equals(_execOptions.ResourceName, StringComparisons.ResourceName)); 172var execResource = BuildResource(targetResource); 186IResource BuildResource(IResource targetExecResource) 196private IResource BuildAgainstResource(ProjectResource project) 243private IResource BuildAgainstResource(ContainerResource container)
Health\ResourceHealthCheckService.cs (3)
82var resource = resourceEvent.Resource; 118var resource = state.LatestEvent.Resource; 255private void FireResourceReadyEvent(IResource resource, CancellationToken cancellationToken)
IDistributedApplicationBuilder.cs (4)
188/// constructs a resource derived from <see cref="IResource"/> and adds it to the application model using the <see cref="AddResource{T}(T)"/> 201IResourceBuilder<T> AddResource<T>(T resource) where T : IResource; 221/// Calling extension methods on the <see cref="IResourceBuilder{T}"/> typically results in modifications to the <see cref="IResource.Annotations"/> 257IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource;
Lifecycle\RequiredCommandValidationLifecycleHook.cs (1)
33var resource = @event.Resource;
Orchestrator\ApplicationOrchestrator.cs (16)
24private readonly ILookup<IResource, IResource> _parentChildLookup; 140private async Task PublishResourceEndpointUrls(IResource resource, CancellationToken cancellationToken) 150private static IEnumerable<UrlSnapshot> GetResourceUrls(IResource resource) 201static Task PublishUpdateAsync(ResourceNotificationService notificationService, IResource resource, string? resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 214private async Task ProcessResourceUrlCallbacks(IResource resource, CancellationToken cancellationToken) 596private async Task SetChildResourceAsync(IResource resource, string? state, DateTime? startTimeStamp, DateTime? stopTimeStamp) 598foreach (var child in _parentChildLookup[resource].Where(c => c is IResourceWithParent)) 625foreach (var resource in _model.Resources) 629var parent = resource is IResourceWithParent hasParent 651private static ImmutableArray<HealthReportSnapshot> GetInitialHealthReports(IResource resource) 662private async Task PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken) 688private async Task PublishEventToHierarchy<TEvent>(Func<IResource, TEvent> createEvent, IResource resource, CancellationToken cancellationToken) 697foreach (var child in children.Where(c => c is IResourceWithParent)) 712private static bool ResourceHasOwnLifetime(IResource resource) =>
Orchestrator\ParameterProcessor.cs (1)
128foreach (var resource in model.Resources)
Orchestrator\RelationshipEvaluator.cs (19)
13public static ILookup<IResource, IResource> GetParentChildLookup(DistributedApplicationModel model) 18.Select(x => (Child: (IResource)x, Parent: x.Parent)) 24private static IEnumerable<(IResource Child, IResource Parent)> GetParentChildRelationshipsFromAnnotations(DistributedApplicationModel model) 26static bool TryGetParent(IResource resource, [NotNullWhen(true)] out IResource? parent) 39static IResource? SelectParentResource(IResource? resource) => resource switch 41IResource r when TryGetParent(r, out var parent) => parent, 54private static void ValidateRelationships((IResource Child, IResource Parent)[] relationships) 64var visited = new Stack<IResource>(); 70static void ValidateNoCircularDependencies(Dictionary<IResource, IResource> childToParentLookup, IResource child, Stack<IResource> visited) 73if (childToParentLookup.TryGetValue(child, out var parent))
OtlpConfigurationExtensions.cs (3)
22public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment) 41public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment, OtlpProtocol protocol) 53private static void RegisterOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment)
Pipelines\DistributedApplicationPipeline.cs (5)
125foreach (var resource in context.Model.GetBuildResources()) 172foreach (var resource in context.Model.Resources) 220var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 483foreach (var resource in context.Model.Resources) 518foreach (var resource in pipelineContext.Model.Resources)
Pipelines\IPipelineOutputService.cs (2)
27string GetOutputDirectory(IResource resource); 40string GetTempDirectory(IResource resource);
Pipelines\PipelineConfigurationContext.cs (3)
42internal ILookup<IResource?, PipelineStep>? StepToResourceMap { get; init; } 63public IEnumerable<PipelineStep> GetSteps(IResource resource) 78public IEnumerable<PipelineStep> GetSteps(IResource resource, string tag)
Pipelines\PipelineOutputService.cs (2)
43public string GetOutputDirectory(IResource resource) 58public string GetTempDirectory(IResource resource)
Pipelines\PipelineStep.cs (1)
58public IResource? Resource { get; set; }
Pipelines\PipelineStepFactoryContext.cs (1)
24public 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)
Publishing\ContainerRuntimeBase.cs (1)
68public virtual async Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\IContainerRuntime.cs (1)
59Task PushImageAsync(IResource resource, CancellationToken cancellationToken);
Publishing\ManifestPublishingContext.cs (22)
44private readonly Dictionary<string, IResource> _referencedResources = []; 84foreach (var resource in model.Resources) 92foreach (var resource in model.Resources) 112internal async Task WriteResourceAsync(IResource resource) 148async Task WriteResourceObjectAsync<T>(T resource, Func<Task> action) where T : IResource 222private void WriteContainerFilesDestination(IResource resource) 233var source = containerFileDestination.Source; 471/// <param name="resource">The <see cref="IResource"/>.</param> 472public void WriteConnectionString(IResource resource) 484/// <see cref="EndpointAnnotation"/> entries in the <see cref="IResource.Annotations"/> 487/// <param name="resource">The <see cref="IResource"/> that contains <see cref="EndpointAnnotation"/> annotations.</param> 488public void WriteBindings(IResource resource) 529/// Writes environment variables to the manifest base on the <see cref="IResource"/> resource's <see cref="EnvironmentCallbackAnnotation"/> annotations."/> 531/// <param name="resource">The <see cref="IResource"/> which contains <see cref="EnvironmentCallbackAnnotation"/> annotations.</param> 532public async Task WriteEnvironmentVariablesAsync(IResource resource) 566/// Writes command line arguments to the manifest based on the <see cref="IResource"/> resource's <see cref="CommandLineArgsCallbackAnnotation"/> annotations. 568/// <param name="resource">The <see cref="IResource"/> that contains <see cref="CommandLineArgsCallbackAnnotation"/> annotations.</param> 570public async Task WriteCommandLineArgumentsAsync(IResource resource) 662/// Ensures that any <see cref="IResource"/> instances referenced by <paramref name="value"/> are 674if (value is IResource resource) 911foreach (var existingResource in model.Resources) 917foreach (var resource in _referencedResources.Values)
Publishing\ResourceContainerImageManager.cs (13)
141Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default); 149Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default); 156Task PushImageAsync(IResource resource, CancellationToken cancellationToken); 181IResource resource, 206public async Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 226foreach (var resource in resources) 235public async Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 295private async Task BuildProjectContainerImageAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 322private async Task<bool> ExecuteDotnetPublishAsync(IResource resource, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 419private async Task BuildContainerImageFromDockerfileAsync(IResource resource, DockerfileBuildAnnotation dockerfileBuildAnnotation, string imageName, ResolvedContainerBuildOptions options, CancellationToken cancellationToken) 515public async Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 521private async Task<bool> ResourcesRequireContainerRuntimeAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken) 523foreach (var resource in resources)
RequiredCommandResourceExtensions.cs (2)
32string? helpLink = null) where T : IResource 69string? helpLink = null) where T : IResource
ResourceBuilderExtensions.cs (60)
427public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource 445public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource 555IResourceBuilder<IResource> source, 629IResourceBuilder<IResource> source, 646IResourceBuilder<IResource> source, 672IResourceBuilder<IResource> source, 677where TCustom : class, IResource, IResourceWithCustomWithReference<TCustom> 1317where T : IResource 1341where T : IResource 1379where T : IResource 1420where T : IResource 1443where T : IResource 1499where T : IResource 1643public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource 1661/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results 1678public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 1698/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results 1706/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 1721public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 1729private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 1731if (builder.Resource as IResource == dependency.Resource) 1771/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>, this method 1786public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport 1806/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/>, this method 1812/// behavior with the <see cref="WaitForStart{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para> 1827public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 1835private static IResourceBuilder<T> WaitForStartCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 1837if (builder.Resource as IResource == dependency.Resource) 1862foreach (var referencedResource in cs.ConnectionStringExpression.ValueProviders.OfType<IResource>()) 1898public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource 1930public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport 1935if (builder.Resource as IResource == dependency.Resource) 1960/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource 1987public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource 2190CommandOptions? commandOptions = null) where T : IResource 2257bool isHighlighted = false) where T : IResource 2867where TResource : IResource 2987IResource resource, 2988string type) where T : IResource 3008IResource resource) where T : IResource 3027ReferenceExpression expression) where T : IResource 3038where T : IResource 3042void AddReference(IResource resource) 3054if (value is IResource resource) 3058else if (value is IResourceBuilder<IResource> resourceBuilder) 3088IResourceBuilder<IResource> resourceBuilder) where T : IResource 3122IResourceBuilder<IResource> parent) where T : IResource 3154IResource parent) where T : IResource 3186IResourceBuilder<IResource> child) where T : IResource 3220IResource child) where T : IResource 3255public static IResourceBuilder<T> WithIconName<T>(this IResourceBuilder<T> builder, string iconName, IconVariant iconVariant = IconVariant.Filled) where T : IResource 3293where T : IResource 3459public static IResourceBuilder<T> ExcludeFromMcp<T>(this IResourceBuilder<T> builder) where T : IResource
ResourceLoggerForwarderService.cs (1)
61private async Task WatchResourceLogs(IResource resource, string resourceId, CancellationToken cancellationToken)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Utils\DockerfileHelper.cs (1)
22IResource resource,
Utils\ExtensionUtils.cs (1)
16public static bool SupportsDebugging(this IResource builder, IConfiguration configuration, [NotNullWhen(true)] out SupportsDebuggingAnnotation? supportsDebuggingAnnotation)
Utils\ImageNameGenerator.cs (2)
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 (24)
AzurePublishingContext.cs (1)
336foreach (var resource in model.Resources)
AzureResourcePreparer.cs (10)
52internal static List<(IResource Resource, IAzureResource AzureResource)> GetAzureResourcesFromAppModel(DistributedApplicationModel appModel) 59var azureResources = new List<(IResource, IAzureResource)>(); 60foreach (var resource in appModel.Resources) 91foreach (var resource in appModel.Resources) 105private async Task BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List<(IResource Resource, IAzureResource AzureResource)> azureResources, CancellationToken cancellationToken) 135foreach (var resource in resourceSnapshot) 252private static Dictionary<AzureProvisioningResource, IEnumerable<RoleDefinition>> GetAllRoleAssignments(IResource resource) 266IResource resource, 296IResource resource, 365private async Task<HashSet<IAzureResource>> GetAzureReferences(IResource resource, CancellationToken cancellationToken)
BicepResourceAnnotation.cs (1)
16/// that can be added to any <see cref="IResource"/> will be detected by the <see cref="AzureProvisioner"/> and used to
ExistingAzureResourceExtensions.cs (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
Provisioning\Provisioners\AzureProvisioner.cs (7)
29private ILookup<IResource, IResourceWithParent>? _parentChildLookup; 43async Task UpdateStateAsync((IResource Resource, IAzureResource AzureResource) resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory) 78async Task AfterProvisionAsync((IResource Resource, IAzureResource AzureResource) resource) 112async Task<bool> WaitForRoleAssignments((IResource Resource, IAzureResource AzureResource) resource) 162IList<(IResource Resource, IAzureResource AzureResource)> azureResources, 187private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, (IResource Resource, IAzureResource AzureResource) resource, CancellationToken cancellationToken) 258async Task PublishConnectionStringAvailableEventRecursiveAsync(IResource targetResource)
Aspire.Hosting.Azure.AppConfiguration (4)
AzureAppConfigurationExtensions.cs (2)
197where T : IResource 216where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.AppContainers (24)
AzureContainerAppEnvironmentResource.cs (7)
57foreach (var computeResource in model.GetComputeResources()) 59var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 95foreach (var computeResource in context.Model.GetComputeResources()) 97var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 115foreach (var computeResource in context.Model.GetBuildResources()) 188internal Dictionary<string, (IResource resource, ContainerMountAnnotation volume, int index, BicepOutputReference outputReference)> VolumeNames { get; } = []; 260internal BicepOutputReference GetVolumeStorage(IResource resource, ContainerMountAnnotation volume, int volumeIndex)
AzureContainerAppResource.cs (2)
25public AzureContainerAppResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 102public IResource TargetResource { get; }
AzureContainerAppsInfrastructure.cs (2)
46foreach (var r in @event.Model.GetComputeResources()) 74foreach (var r in appModel.GetComputeResources())
BaseContainerAppContext.cs (3)
15internal abstract class BaseContainerAppContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext) 19public IResource Resource => resource; 89protected static bool TryGetContainerImageName(IResource resource, out string? containerImageName)
ContainerAppContext.cs (1)
14internal sealed class ContainerAppContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
ContainerAppEnvironmentContext.cs (4)
26private readonly Dictionary<IResource, BaseContainerAppContext> _containerApps = new(new ResourceNameComparer()); 64public BaseContainerAppContext GetContainerAppContext(IResource resource) 74public async Task<AzureBicepResource> CreateContainerAppAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken) 99private BaseContainerAppContext CreateContainerAppContext(IResource resource)
ContainerAppJobContext.cs (1)
14internal sealed class ContainerAppJobContext(IResource resource, ContainerAppEnvironmentContext containerAppEnvironmentContext)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Azure.AppService (21)
AzureAppServiceEnvironmentContext.cs (3)
24private readonly Dictionary<IResource, AzureAppServiceWebsiteContext> _appServices = new(new ResourceNameComparer()); 26public AzureAppServiceWebsiteContext GetAppServiceContext(IResource resource) 36public async Task<AzureBicepResource> CreateAppServiceAsync(IResource resource, AzureProvisioningOptions provisioningOptions, CancellationToken cancellationToken)
AzureAppServiceEnvironmentResource.cs (8)
72foreach (var computeResource in model.GetComputeResources()) 74var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 110foreach (var computeResource in context.Model.GetComputeResources()) 112var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 130foreach (var computeResource in context.Model.GetBuildResources()) 173foreach (var computeResource in model.GetComputeResources()) 175var deploymentTarget = computeResource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 220private static string? ValidateEnvironmentVariableNames(IResource resource, AzureAppServiceWebsiteContext appServiceContext)
AzureAppServiceInfrastructure.cs (2)
51foreach (var resource in @event.Model.GetComputeResources()) 79foreach (var r in appModel.GetComputeResources())
AzureAppServiceWebsiteContext.cs (2)
18IResource resource, 21public IResource Resource => resource;
AzureAppServiceWebSiteResource.cs (2)
25public AzureAppServiceWebSiteResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure, IResource targetResource) 100public IResource TargetResource { get; }
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Azure.CognitiveServices (4)
AzureOpenAIExtensions.cs (2)
233where T : IResource 252where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ContainerRegistry (7)
AzureContainerRegistryExtensions.cs (5)
86foreach (var resource in beforeStartEvent.Model.Resources) 106where T : IResource, IComputeEnvironmentResource 128where T : IResource, IAzureComputeEnvironmentResource 274where T : IResource 293where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.EventHubs (4)
AzureEventHubsExtensions.cs (2)
518where T : IResource 537where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Functions (4)
AzureFunctionsProjectResourceExtensions.cs (1)
356IResourceBuilder<IResource> source,
AzureFunctionsResource.cs (1)
23IResourceBuilder<IResource> source,
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.KeyVault (6)
AzureKeyVaultResourceExtensions.cs (2)
175where T : IResource 194where T : IResource
AzureKeyVaultSecretReference.cs (1)
28public IResource? SecretOwner { get; set; }
AzureKeyVaultSecretResource.cs (1)
42IResource? IAzureKeyVaultSecretReference.SecretOwner { get; set; }
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Kusto (3)
AzureKustoBuilderExtensions.cs (1)
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 (1)
AzurePrivateEndpointExtensions.cs (1)
79IResource rootResource = target.Resource;
Aspire.Hosting.Azure.Search (4)
AzureSearchExtensions.cs (2)
135where T : IResource 154where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.ServiceBus (4)
AzureServiceBusExtensions.cs (2)
671where T : IResource 690where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.SignalR (4)
AzureSignalRExtensions.cs (2)
200where T : IResource 219where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Sql (4)
AzureSqlServerResource.cs (4)
527public IResource Parent => storage; 643private sealed class FakeBuilder<T>(T resource, IDistributedApplicationBuilder applicationBuilder) : IResourceBuilder<T> where T : IResource 659public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource 664public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource
Aspire.Hosting.Azure.Storage (4)
AzureStorageExtensions.cs (2)
694where T : IResource 718where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Azure.Tests (68)
AzureAppServiceTests.cs (3)
245var container = Assert.Single(model.GetContainerResources()); 281var container = Assert.Single(model.GetContainerResources()); 989private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
AzureBicepResourceTests.cs (6)
33public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensions => 36private static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> CreateAllAzureExtensions(string resourceName) 76public void AzureExtensionsAutomaticallyAddAzureProvisioning(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 88public void BicepResourcesAreIdempotent(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource) 104public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensionsWithHyphen => 109public void AzureResourcesProduceValidBicep(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
AzureContainerAppsTests.cs (40)
43var container = Assert.Single(model.GetContainerResources()); 77var container = Assert.Single(model.GetContainerResources()); 181var container = Assert.Single(model.GetContainerResources()); 224var container = Assert.Single(model.GetContainerResources()); 254var container = Assert.Single(model.GetContainerResources()); 447var container = Assert.Single(model.GetContainerResources()); 479var container = Assert.Single(model.GetContainerResources()); 513var container = Assert.Single(model.GetContainerResources()); 549var container = Assert.Single(model.GetContainerResources()); 587var container = Assert.Single(model.GetContainerResources()); 627var container = Assert.Single(model.GetContainerResources()); 659var container = Assert.Single(model.GetContainerResources()); 692var container = Assert.Single(model.GetContainerResources()); 743var container = Assert.Single(model.GetContainerResources()); 825var container = Assert.Single(model.GetContainerResources()); 868var container = Assert.Single(model.GetContainerResources()); 899var container = Assert.Single(model.GetContainerResources()); 931var container = Assert.Single(model.GetContainerResources()); 1217var container = Assert.Single(model.GetContainerResources()); 1248var container = Assert.Single(model.GetContainerResources()); 1279var container = Assert.Single(model.GetContainerResources()); 1622var container = Assert.Single(model.GetContainerResources()); 1645private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) => 1669var container = Assert.Single(model.GetContainerResources()); 1787var container = Assert.Single(model.GetContainerResources()); 1846var funcjob = model.Resources.Single(r => r.Name == "funcjob"); 1890var batch = containers.First(c => c.Name == "batch"); 1891var web = containers.First(c => c.Name == "web"); 1927var container = Assert.Single(model.GetContainerResources()); 1957var container = Assert.Single(model.GetContainerResources()); 1996var container = Assert.Single(model.GetContainerResources()); 2036var container = Assert.Single(model.GetContainerResources()); 2076var container = Assert.Single(model.GetContainerResources()); 2121var container = model.Resources.Single(r => r.Name == "api"); 2125var buildOnly = model.Resources.Single(r => r.Name == "build-only"); 2151var container = Assert.Single(model.GetContainerResources()); 2341var webappAcaResource = model.Resources.First(r => r.Name == "webappaca"); 2347var webappServiceResource = model.Resources.First(r => r.Name == "webappservice"); 2353var containerAcaResource = model.Resources.First(r => r.Name == "containeraca"); 2361var containerAppServiceResource = model.Resources.First(r => r.Name == "containerappservice");
AzureDeployerTests.cs (1)
182var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
AzureEventHubsExtensionsTests.cs (1)
517var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage");
AzureFunctionsTests.cs (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)
17public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource, bool skipPreparer = false) => 20public static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource) => 23private static async Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(DistributedApplicationModel appModel, IResource resource, bool skipPreparer)
AzurePostgresExtensionsTests.cs (2)
297var postgresResourceInModel = builder.Resources.Single(r => r.Name == "postgres-data"); 298var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
AzureProvisioningResourceTests.cs (1)
104var containerResource = Assert.Single(model.GetContainerResources());
AzureRedisExtensionsTests.cs (1)
177var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureServiceBusExtensionsTests.cs (1)
614var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql");
AzureSqlExtensionsTests.cs (2)
217var sqlResourceInModel = builder.Resources.Single(r => r.Name == "sql"); 218var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
ContainerRegistryTests.cs (1)
155foreach (var resource in model.Resources)
RoleAssignmentTests.cs (1)
366private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>
Aspire.Hosting.Azure.WebPubSub (4)
AzureWebPubSubExtensions.cs (2)
316where T : IResource 335where T : IResource
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.CodeGeneration.Go.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
91bool enabled = true) where T : IResource 104double multiplier = 1.5) where T : IResource 395TestConfigDto config) where T : IResource 447DateTime createdAt) where T : IResource 458DateTimeOffset modifiedAt) where T : IResource 469Guid correlationId) where T : IResource 480Func<TestCallbackContext, Task>? callback = null) where T : IResource 492TestResourceStatus status) where T : IResource 503TestNestedDto config) where T : IResource 514Func<TestResourceContext, Task<bool>> validator) where T : IResource 526IResourceBuilder<IResource> dependency) where T : IResource 575IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 586IReadOnlyList<string> endpoints) where T : IResource 621Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Java.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
91bool enabled = true) where T : IResource 104double multiplier = 1.5) where T : IResource 395TestConfigDto config) where T : IResource 447DateTime createdAt) where T : IResource 458DateTimeOffset modifiedAt) where T : IResource 469Guid correlationId) where T : IResource 480Func<TestCallbackContext, Task>? callback = null) where T : IResource 492TestResourceStatus status) where T : IResource 503TestNestedDto config) where T : IResource 514Func<TestResourceContext, Task<bool>> validator) where T : IResource 526IResourceBuilder<IResource> dependency) where T : IResource 575IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 586IReadOnlyList<string> endpoints) where T : IResource 621Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Python.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
91bool enabled = true) where T : IResource 104double multiplier = 1.5) where T : IResource 395TestConfigDto config) where T : IResource 447DateTime createdAt) where T : IResource 458DateTimeOffset modifiedAt) where T : IResource 469Guid correlationId) where T : IResource 480Func<TestCallbackContext, Task>? callback = null) where T : IResource 492TestResourceStatus status) where T : IResource 503TestNestedDto config) where T : IResource 514Func<TestResourceContext, Task<bool>> validator) where T : IResource 526IResourceBuilder<IResource> dependency) where T : IResource 575IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 586IReadOnlyList<string> endpoints) where T : IResource 621Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.Rust.Tests (15)
tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\TestTypes\TestExtensions.cs (15)
91bool enabled = true) where T : IResource 104double multiplier = 1.5) where T : IResource 395TestConfigDto config) where T : IResource 447DateTime createdAt) where T : IResource 458DateTimeOffset modifiedAt) where T : IResource 469Guid correlationId) where T : IResource 480Func<TestCallbackContext, Task>? callback = null) where T : IResource 492TestResourceStatus status) where T : IResource 503TestNestedDto config) where T : IResource 514Func<TestResourceContext, Task<bool>> validator) where T : IResource 526IResourceBuilder<IResource> dependency) where T : IResource 575IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 586IReadOnlyList<string> endpoints) where T : IResource 621Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.CodeGeneration.TypeScript.Tests (15)
TestTypes\TestExtensions.cs (15)
91bool enabled = true) where T : IResource 104double multiplier = 1.5) where T : IResource 395TestConfigDto config) where T : IResource 447DateTime createdAt) where T : IResource 458DateTimeOffset modifiedAt) where T : IResource 469Guid correlationId) where T : IResource 480Func<TestCallbackContext, Task>? callback = null) where T : IResource 492TestResourceStatus status) where T : IResource 503TestNestedDto config) where T : IResource 514Func<TestResourceContext, Task<bool>> validator) where T : IResource 526IResourceBuilder<IResource> dependency) where T : IResource 575IResourceBuilder<IResourceWithConnectionString> dependency) where T : IResource 586IReadOnlyList<string> endpoints) where T : IResource 621Func<CancellationToken, Task> operation) where T : IResource
Aspire.Hosting.Containers.Tests (13)
ContainerResourceBuilderTests.cs (1)
218where T: IResource
ContainerResourceTests.cs (10)
24var containerResource = Assert.Single(containerResources); 43var containerResource = Assert.Single(containerResources); 62var containerResource = Assert.Single(containerResources); 82var containerResource = Assert.Single(containerResources); 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());
WithDockerfileTests.cs (2)
930var resource = Assert.Single(containerResources); 970var resource1 = Assert.Single(containerResources1);
Aspire.Hosting.DevTunnels (7)
DevTunnelResourceBuilderExtensions.cs (3)
371/// This method is not available in polyglot app hosts. Use <see cref="GetEndpoint(IResourceBuilder{DevTunnelResource}, IResource, string)"/> instead. 401public static EndpointReference GetEndpoint(this IResourceBuilder<DevTunnelResource> tunnelBuilder, IResource resource, string endpointName) 442private static EndpointReference CreateEndpointReferenceWithError(DevTunnelResource tunnelResource, IResource targetResource, string endpointName)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Docker (27)
CapturedEnvironmentVariable.cs (1)
41public IResource? Resource { get; set; }
DockerComposeEnvironmentContext.cs (1)
12public async Task<DockerComposeServiceResource> CreateDockerComposeServiceResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
DockerComposeEnvironmentResource.cs (8)
53internal Dictionary<IResource, DockerComposeServiceResource> ResourceMapping { get; } = new(new ResourceNameComparer()); 79foreach (var resource in resources) 81var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 145foreach (var resource in resources) 147var deploymentTarget = resource.GetDeploymentTargetAnnotation(this)?.DeploymentTarget; 170foreach (var computeResource in context.Model.GetBuildResources()) 180foreach (var pushResource in context.Model.GetBuildAndPushResources()) 376internal string AddEnvironmentVariable(string name, string? description = null, string? defaultValue = null, object? source = null, IResource? resource = null)
DockerComposeInfrastructure.cs (3)
53foreach (var r in @event.Model.GetComputeResources()) 102foreach (var r in appModel.GetComputeResources()) 111private static void ConfigureOtlp(IResource resource, EndpointReference otlpEndpoint)
DockerComposePublishingContext.cs (3)
77IEnumerable<IResource> resources = environment.Dashboard?.Resource is IResource r 81foreach (var resource in resources)
DockerComposeServiceExtensions.cs (2)
113var resourceInstance = dockerComposeService.TargetResource; 127var resourceInstance = dockerComposeService.TargetResource;
DockerComposeServiceResource.cs (5)
26private readonly IResource _targetResource; 35public DockerComposeServiceResource(string name, IResource resource, DockerComposeEnvironmentResource composeEnvironmentResource) : base(name) 77IResource Resource, 88internal IResource TargetResource => _targetResource; 135private bool TryGetContainerImageName(IResource resourceInstance, out string? containerImageName)
src\Shared\ResourceNameComparer.cs (4)
8internal sealed class ResourceNameComparer : IEqualityComparer<IResource?> 10public bool Equals(IResource? x, IResource? y) 20public int GetHashCode(IResource obj) =>
Aspire.Hosting.Docker.Tests (13)
DockerComposePublisherTests.cs (3)
1016public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 1022public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 1028public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
DockerComposeTests.cs (10)
235public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 241public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 247public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 682public Task BuildImageAsync(IResource resource, CancellationToken cancellationToken = default) 685public Task BuildImagesAsync(IEnumerable<IResource> resources, CancellationToken cancellationToken = default) 688public Task PushImageAsync(IResource resource, CancellationToken cancellationToken) 829var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 835var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 841var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 847var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s");
Aspire.Hosting.Foundry (7)
FoundryExtensions.cs (2)
199where T : IResource 218where T : IResource
HostedAgent\AzureHostedAgentResource.cs (3)
23public AzureHostedAgentResource([ResourceName] string name, IResource target, Action<HostedAgentConfiguration>? configure = null) : base(name) 91public IResource Target { get; } 154IResource resource,
src\Shared\AzureRoleAssignmentUtils.cs (2)
11where T : IResource 19where T : IResource
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
44var resource = builder.Resources.Single(r => r.Name == "agent");
Aspire.Hosting.JavaScript (1)
JavaScriptHostingExtensions.cs (1)
1083private static void ValidateBrowserCapability<T>(IResourceBuilder<T> builder) where T : IResource
Aspire.Hosting.JavaScript.Tests (6)
AddNodeAppTests.cs (2)
22&& parameters[1].ParameterType == typeof(IResourceBuilder<IResource>)); 580IResourceBuilder<IResource> source,
IntegrationTests.cs (3)
40foreach (var installer in npmInstallers.Cast<IResource>()) 53var waitedResource = waitAnnotations.First().Resource;
PackageInstallationTests.cs (1)
67var nodeResource = Assert.Single(appModel.Resources, r => r.Name == "test-app");
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
175var kafkaUiResource = Assert.Single(builder.Resources, r => r.Name == expectedContainerName);
Aspire.Hosting.Keycloak.Tests (2)
KeycloakPublicApiTests.cs (2)
163var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal)); 190var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal));
Aspire.Hosting.Kubernetes (20)
Extensions\ResourceExtensions.cs (7)
11internal static Deployment ToDeployment(this IResource resource, KubernetesResource context) 40internal static StatefulSet ToStatefulSet(this IResource resource, KubernetesResource context) 60internal static Secret? ToSecret(this IResource resource, KubernetesResource context) 92internal static ConfigMap? ToConfigMap(this IResource resource, KubernetesResource context) 122internal static Service? ToService(this IResource resource, KubernetesResource context) 172private static PodTemplateSpecV1 ToPodTemplateSpec(this IResource resource, KubernetesResource context) 239private static ContainerV1 ToContainerV1(this IResource resource, KubernetesResource context)
KubernetesEnvironmentContext.cs (2)
11private readonly Dictionary<IResource, KubernetesResource> _kubernetesComponents = new(new ResourceNameComparer()); 15public async Task<KubernetesResource> CreateKubernetesResourceAsync(IResource resource, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
KubernetesInfrastructure.cs (2)
39foreach (var r in @event.Model.GetComputeResources()) 62foreach (var r in appModel.GetComputeResources())
KubernetesPublishingContext.cs (4)
69foreach (var resource in model.Resources) 108private async Task AppendResourceContextToHelmValuesAsync(IResource resource, KubernetesResource resourceContext) 125IResource resource, 164private async Task WriteKubernetesTemplatesForResource(IResource resource, IEnumerable<BaseKubernetesResource> templatedItems)
KubernetesResource.cs (5)
16public partial class KubernetesResource(string name, IResource resource, KubernetesEnvironmentResource kubernetesEnvironmentResource) : Resource(name), IResourceWithParent<KubernetesEnvironmentResource> 63internal IResource TargetResource => resource; 136internal string GetContainerImageName(IResource resourceInstance) 590private static HelmValue AllocateParameter(ParameterResource parameter, IResource resource) 609private static HelmValue ResolveUnknownValue(IManifestExpressionProvider parameter, IResource resource)
Aspire.Hosting.Kubernetes.Tests (4)
KubernetesEnvironmentResourceTests.cs (4)
150var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 156var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 162var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 168var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker");
Aspire.Hosting.Maui (5)
Lifecycle\UnsupportedPlatformEventSubscriber.cs (1)
28foreach (var resource in @event.Model.Resources)
Utilities\MauiAndroidEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Utilities\MauiEnvironmentHelper.cs (2)
35IResource resource, 223IResource resource,
Utilities\MauiiOSEnvironmentAnnotation.cs (1)
55var resource = @event.Resource;
Aspire.Hosting.Maui.Tests (8)
MauiPlatformExtensionsTests.cs (8)
152var resource = platform.Resource; 470IResource resource; 537IResource resource; 720public Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> AddPlatformWithDefaultName { get; } 721public Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> AddPlatformWithCustomName { get; } 722public Action<IResourceBuilder<IResource>> ApplyWithOtlpDevTunnel { get; } 731Func<IResourceBuilder<MauiProjectResource>, IResourceBuilder<IResource>> addDefault, 732Func<IResourceBuilder<MauiProjectResource>, string, IResourceBuilder<IResource>> addCustom,
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
27var containerResource = Assert.Single(appModel.GetContainerResources()); 57var containerResource = Assert.Single(appModel.GetContainerResources());
Aspire.Hosting.MySql (1)
MySqlBuilderExtensions.cs (1)
103/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (4)
85var containerResource = Assert.Single(appModel.GetContainerResources()); 242var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin")); 248var container = builder.Resources.Single(r => r.Name == "phpmyadmin"); 274var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin"));
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
44var containerResource = Assert.Single(appModel.GetContainerResources()); 83var containerResource = Assert.Single(appModel.GetContainerResources()); 165var containerResource = Assert.Single(containerResources);
Aspire.Hosting.PostgreSQL (2)
PostgresBuilderExtensions.cs (2)
39/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 134/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
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.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)
232var qdrantResource = builder.Resources.Single(r => r.Name.Equals("qdrant"));
Aspire.Hosting.Redis (2)
RedisBuilderExtensions.cs (2)
32/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> 55/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Redis.Tests (4)
AddRedisTests.cs (4)
263var redisinsight = builder.Resources.Single(r => r.Name.Equals("redisinsight")); 487var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 513var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 534var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander"));
Aspire.Hosting.RemoteHost.Tests (4)
AttributeDataReaderTests.cs (3)
182public static void OfficialExportMethod(IResource resource) 188public static void OverriddenNameMethod(IResource resource) 272[typeof(IResource)]);
CapabilityDispatcherTests.cs (1)
1773internal sealed class TestResourceBuilder<T> : IResourceBuilder<T> where T : IResource
Aspire.Hosting.SqlServer (1)
SqlServerBuilderExtensions.cs (1)
105/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
Aspire.Hosting.Testing (10)
DistributedApplicationHostingTestingExtensions.cs (4)
52var resource = GetResource(app, resourceName); 128static IResource GetResource(DistributedApplication app, string resourceName) 134var resource = resources.SingleOrDefault(r => string.Equals(r.Name, resourceName, StringComparison.OrdinalIgnoreCase)); 146var resource = GetResource(app, resourceName);
DistributedApplicationTestingBuilder.cs (6)
251public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => innerBuilder.AddResource(resource); 261public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => innerBuilder.CreateResourceBuilder(resource); 405public IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => _innerBuilder.AddResource(resource); 419public IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => _innerBuilder.CreateResourceBuilder(resource); 502new IResourceBuilder<T> AddResource<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).AddResource(resource); 505new IResourceBuilder<T> CreateResourceBuilder<T>(T resource) where T : IResource => ((IDistributedApplicationBuilder)this).CreateResourceBuilder(resource);
Aspire.Hosting.Testing.Tests (3)
TestingBuilderTests.cs (1)
106foreach (var resource in appModel.GetContainerResources())
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
tests\Shared\ConsoleLogging\ConsoleLoggingTestHelpers.cs (1)
8public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
Aspire.Hosting.Tests (79)
ApplicationModel\Docker\DockerfileBuilderCallbackContextTests.cs (1)
135Assert.IsAssignableFrom<IResource>(context.Resource);
Dashboard\DashboardLifecycleHookTests.cs (6)
93var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 241var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 321var dashboardResource = Assert.Single(model.Resources); 404var dashboardResource = Assert.Single(model.Resources); 473var dashboardResource = Assert.Single(model.Resources); 540var dashboardResource = Assert.Single(model.Resources);
Dashboard\DashboardResourceTests.cs (11)
111var dashboard = Assert.Single(model.Resources); 228var dashboard = Assert.Single(model.Resources); 303var dashboard = Assert.Single(model.Resources); 342var dashboard = Assert.Single(model.Resources); 378var dashboard = Assert.Single(model.Resources); 417var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 421var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 462var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 494var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 694var dashboard = Assert.Single(model.Resources); 726static void SetDashboardAllocatedEndpoints(IResource dashboard, int otlpGrpcPort, int otlpHttpPort, int httpPort, int mcpPort, int httpsPort)
Dcp\DcpExecutorTests.cs (4)
2326private static void HasKnownCommandAnnotations(IResource resource) 2335private static void HasKnownProjectCommandAnnotations(IResource resource) 2682private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 2684public IResource Parent => parent;
DistributedApplicationBuilderTests.cs (1)
73var resource = Assert.Single(appModel.Resources);
DistributedApplicationTests.cs (2)
598foreach (var item in appModel.Resources) 1209var aspireDashboard = model.Resources.Single(r => r.Name == KnownResourceNames.AspireDashboard);
Eventing\DistributedApplicationBuilderEventingTests.cs (2)
273var resourceStopped = default(IResource);
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)
Orchestrator\ApplicationOrchestratorTests.cs (3)
528private sealed class CustomChildResource(string name, IResource parent) : Resource(name), IResourceWithParent 530public IResource Parent => parent; 584public IResource Parent { get; } = parent;
Orchestrator\ParameterProcessorTests.cs (1)
84var 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 (5)
954IResource? capturedResource = null; 1536IResource? targetResource = null; 1565var resource2Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource2"); 1608var resource1Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource1"); 1678IResource? capturedResource = null;
ProjectResourceTests.cs (1)
879var builtImage = Assert.Single(mockImageBuilder.BuildImageResources);
Publishing\FakeContainerRuntime.cs (2)
26public ConcurrentBag<IResource> PushImageCalls { get; } = []; 63public Task PushImageAsync(IResource resource, CancellationToken cancellationToken)
Publishing\ResourceContainerImageManagerTests.cs (1)
1165IResource? capturedResource = null;
RequiredCommandAnnotationTests.cs (15)
154var resource = appModel.Resources.Single(r => r.Name == "test"); 170var resource = appModel.Resources.Single(r => r.Name == "test"); 188var resource = appModel.Resources.Single(r => r.Name == "test"); 213var resource = appModel.Resources.Single(r => r.Name == "test"); 240var resource = appModel.Resources.Single(r => r.Name == "test"); 264var resource = appModel.Resources.Single(r => r.Name == "test"); 285var resource = appModel.Resources.Single(r => r.Name == "test"); 305var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 306var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 339var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 340var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 364var resource = appModel.Resources.Single(r => r.Name == "test"); 396var resource = appModel.Resources.Single(r => r.Name == "test"); 421var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 422var resource2 = appModel.Resources.Single(r => r.Name == "test2");
ResourceDependencyTests.cs (2)
689Array.Empty<IResource>(), executionContext); 873foreach (var dep in singleDeps)
ResourceNotificationTests.cs (1)
55IResource resource = resourceType.Name switch
tests\Shared\ConsoleLogging\ConsoleLoggingTestHelpers.cs (1)
8public static Task<IReadOnlyList<LogLine>> WatchForLogsAsync(ResourceLoggerService service, int targetLogCount, IResource resource)
Utils\ArgumentEvaluator.cs (1)
11public static async ValueTask<List<string>> GetArgumentListAsync(IResource resource, IServiceProvider? serviceProvider = null)
Utils\EnvironmentVariableEvaluator.cs (1)
12IResource resource,
Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
Utils\ManifestUtils.cs (4)
13public static async Task<JsonNode> GetManifest(IResource resource, string? manifestDirectory = null) 20public static async Task<JsonNode?> GetManifestOrNull(IResource resource, string? manifestDirectory = null) 66public static async Task<JsonNode[]> GetManifests(IResource[] resources) 79foreach (var r in resources)
WithEnvironmentTests.cs (2)
483private readonly IResource _referencedResource; 485public TestValueWithReferences(string value, IResource referencedResource)
WithHttpCommandTests.cs (1)
526private static async Task MoveResourceToRunningStateAsync(DistributedApplication app, IResource resource, string commandName = "mycommand")
WithReferenceTests.cs (2)
262ResourceBuilderExtensions.WithReference(projectB, (IResourceBuilder<IResource>)resource, connectionName: "db", name: "api"); 284ResourceBuilderExtensions.WithReference(projectB, (IResourceBuilder<IResource>)resource, connectionName: "db");
Aspire.Hosting.Yarp (1)
YarpResourceExtensions.cs (1)
239private static string GetYarpImageName(IResource resource)
Aspire.Playground.Tests (3)
Infrastructure\DistributedApplicationExtensions.cs (2)
72var resource = resourceVolume.Resource; 144static bool ShouldAssertErrorsForResource(IResource resource)
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (1)
31public static async Task WaitForHealthyAsync<T>(this DistributedApplication app, IResourceBuilder<T> resource, CancellationToken cancellationToken = default) where T : IResource
Pipelines.Library (1)
DistributedApplicationPipelineExtensions.cs (1)
30foreach (var resource in context.Model.GetComputeResources())
Stress.AppHost (7)
InteractionCommands.cs (1)
13public static IResourceBuilder<T> AddInteractionCommands<T>(this IResourceBuilder<T> resource) where T : IResource
Program.cs (3)
19IResource parent = rb.Resource; 143IResourceBuilder<IResource>? previousResourceBuilder = null; 177foreach (var r in resources)
TestResource.cs (3)
33public static IResourceBuilder<TestNestedResource> AddNestedResource(this IDistributedApplicationBuilder builder, string name, IResource parent) 116sealed class TestNestedResource(string name, IResource parent) : Resource(name), IResourceWithParent 118public IResource Parent { get; } = parent;