2839 references to IResourceBuilder
Aspire.Hosting (399)
ApplicationModel\HttpCommandContext.cs (2)
8/// <see cref="ResourceBuilderExtensions.WithHttpCommand{TResource}(IResourceBuilder{TResource}, string, string, string?, string?, HttpCommandOptions?)"/>
9/// or <see cref="ResourceBuilderExtensions.WithHttpCommand{TResource}(IResourceBuilder{TResource}, string, string, Func{EndpointReference}?, string?, HttpCommandOptions?)"/>.
ApplicationModel\ResourceExtensions.cs (4)
304(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key: null, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
306(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
363(DistributedApplicationOperation.Run, IResourceBuilder<IResource> rb) when rb.Resource is IValueProvider provider => await GetValue(key, provider, logger, resource.IsContainer(), containerHostName, cancellationToken).ConfigureAwait(false),
365(DistributedApplicationOperation.Publish, IResourceBuilder<IResource> rb) when rb.Resource is IManifestExpressionProvider provider => new(provider.ValueExpression, false),
ContainerResourceBuilderExtensions.cs (100)
21/// <returns>The <see cref="IResourceBuilder{T}"/> for chaining.</returns>
22public static IResourceBuilder<ContainerResource> AddContainer(this IDistributedApplicationBuilder builder, [ResourceName] string name, string image)
40/// <returns>The <see cref="IResourceBuilder{T}"/> for chaining.</returns>
41public static IResourceBuilder<ContainerResource> AddContainer(this IDistributedApplicationBuilder builder, [ResourceName] string name, string image, string tag)
55/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
59/// They are not shared with the host's file-system. To mount files from the host inside the container, call <see cref="WithBindMount{T}(IResourceBuilder{T}, string, string, bool)"/>.
80public static IResourceBuilder<T> WithVolume<T>(this IResourceBuilder<T> builder, string? name, string target, bool isReadOnly = false) where T : ContainerResource
95/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
99/// They are not shared with the host's file-system. To mount files from the host inside the container, call <see cref="WithBindMount{T}(IResourceBuilder{T}, string, string, bool)"/>.
103/// <see cref="WithVolume{T}(IResourceBuilder{T}, string?, string, bool)"/> and specify the same value for <c>name</c>.
120public static IResourceBuilder<T> WithVolume<T>(this IResourceBuilder<T> builder, string target) where T : ContainerResource
137/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
141/// using volumes instead via <see cref="WithVolume{T}(IResourceBuilder{T}, string?, string, bool)"/>.
175public static IResourceBuilder<T> WithBindMount<T>(this IResourceBuilder<T> builder, string source, string target, bool isReadOnly = false) where T : ContainerResource
191/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
192public static IResourceBuilder<T> WithEntrypoint<T>(this IResourceBuilder<T> builder, string entrypoint) where T : ContainerResource
207/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
208public static IResourceBuilder<T> WithImageTag<T>(this IResourceBuilder<T> builder, string tag) where T : ContainerResource
228/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
229public static IResourceBuilder<T> WithImageRegistry<T>(this IResourceBuilder<T> builder, string? registry) where T : ContainerResource
249/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
250public static IResourceBuilder<T> WithImage<T>(this IResourceBuilder<T> builder, string image, string? tag = null) where T : ContainerResource
307/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
308public static IResourceBuilder<T> WithImageSHA256<T>(this IResourceBuilder<T> builder, string sha256) where T : ContainerResource
326/// This is intended to pass additional arguments to the underlying container runtime run command to enable advanced features such as exposing GPUs to the container. To pass runtime arguments to the actual container, use the <see cref="ResourceBuilderExtensions.WithArgs{T}(IResourceBuilder{T}, string[])"/> method.
331/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
332public static IResourceBuilder<T> WithContainerRuntimeArgs<T>(this IResourceBuilder<T> builder, params string[] args) where T : ContainerResource
343/// This is intended to pass additional arguments to the underlying container runtime run command to enable advanced features such as exposing GPUs to the container. To pass runtime arguments to the actual container, use the <see cref="ResourceBuilderExtensions.WithArgs{T}(IResourceBuilder{T}, Action{CommandLineArgsCallbackContext})"/> method.
348/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
349public static IResourceBuilder<T> WithContainerRuntimeArgs<T>(this IResourceBuilder<T> builder, Action<ContainerRuntimeArgsCallbackContext> callback) where T : ContainerResource
365/// This is intended to pass additional arguments to the underlying container runtime run command to enable advanced features such as exposing GPUs to the container. To pass runtime arguments to the actual container, use the <see cref="ResourceBuilderExtensions.WithArgs{T}(IResourceBuilder{T}, Func{CommandLineArgsCallbackContext, Task})"/> method.
370/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
371public static IResourceBuilder<T> WithContainerRuntimeArgs<T>(this IResourceBuilder<T> builder, Func<ContainerRuntimeArgsCallbackContext, Task> callback) where T : ContainerResource
386/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
398public static IResourceBuilder<T> WithLifetime<T>(this IResourceBuilder<T> builder, ContainerLifetime lifetime) where T : ContainerResource
411/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
412public static IResourceBuilder<T> WithImagePullPolicy<T>(this IResourceBuilder<T> builder, ImagePullPolicy pullPolicy) where T : ContainerResource
419private static IResourceBuilder<T> ThrowResourceIsNotContainer<T>(IResourceBuilder<T> builder) where T : ContainerResource
428/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
429public static IResourceBuilder<T> PublishAsContainer<T>(this IResourceBuilder<T> builder) where T : ContainerResource
440/// <param name="builder">The <see cref="IResourceBuilder{T}"/>.</param>
444/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
457/// When generating the manifest for deployment tools, the <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>
473public static IResourceBuilder<T> WithDockerfile<T>(this IResourceBuilder<T> builder, string contextPath, string? dockerfilePath = null, string? stage = null) where T : ContainerResource
502/// <returns>A <see cref="IResourceBuilder{ContainerResource}"/>.</returns>
525public static IResourceBuilder<ContainerResource> AddDockerfile(this IDistributedApplicationBuilder builder, [ResourceName] string name, string contextPath, string? dockerfilePath = null, string? stage = null)
547/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
548public static IResourceBuilder<T> WithContainerName<T>(this IResourceBuilder<T> builder, string name) where T : ContainerResource
563/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
565/// Thrown when <see cref="ContainerResourceBuilderExtensions.WithBuildArg{T}(IResourceBuilder{T}, string, object)"/> is
566/// called before <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>.
570/// The <see cref="ContainerResourceBuilderExtensions.WithBuildArg{T}(IResourceBuilder{T}, string, object)"/> extension method
572/// <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>.
587public static IResourceBuilder<T> WithBuildArg<T>(this IResourceBuilder<T> builder, string name, object? value) where T : ContainerResource
611/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
613/// Thrown when <see cref="ContainerResourceBuilderExtensions.WithBuildArg{T}(IResourceBuilder{T}, string, IResourceBuilder{ParameterResource})"/> is
614/// called before <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>.
618/// The <see cref="ContainerResourceBuilderExtensions.WithBuildArg{T}(IResourceBuilder{T}, string, IResourceBuilder{ParameterResource})"/> extension method
620/// <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>.
637public static IResourceBuilder<T> WithBuildArg<T>(this IResourceBuilder<T> builder, string name, IResourceBuilder<ParameterResource> value) where T : ContainerResource
658/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
660/// Thrown when <see cref="ContainerResourceBuilderExtensions.WithBuildSecret{T}(IResourceBuilder{T}, string, IResourceBuilder{ParameterResource})"/> is
661/// called before <see cref="ContainerResourceBuilderExtensions.WithDockerfile{T}(IResourceBuilder{T}, string, string?, string?)"/>.
665/// The <see cref="ContainerResourceBuilderExtensions.WithBuildSecret{T}(IResourceBuilder{T}, string, IResourceBuilder{ParameterResource})"/> extension method
684public static IResourceBuilder<T> WithBuildSecret<T>(this IResourceBuilder<T> builder, string name, IResourceBuilder<ParameterResource> value) where T : ContainerResource
712/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
744public static IResourceBuilder<T> WithContainerFiles<T>(this IResourceBuilder<T> builder, string destinationPath, IEnumerable<ContainerFileSystemItem> entries, int? defaultOwner = null, int? defaultGroup = null, UnixFileMode? umask = null) where T : ContainerResource
775/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
817public static IResourceBuilder<T> WithContainerFiles<T>(this IResourceBuilder<T> builder, string destinationPath, Func<ContainerFileSystemCallbackContext, CancellationToken, Task<IEnumerable<ContainerFileSystemItem>>> callback, int? defaultOwner = null, int? defaultGroup = null, UnixFileMode? umask = null) where T : ContainerResource
844/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
852public static IResourceBuilder<T> WithEndpointProxySupport<T>(this IResourceBuilder<T> builder, bool proxyEnabled) where T : ContainerResource
ExecutableResourceBuilderExtensions.cs (15)
22/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
23public static IResourceBuilder<ExecutableResource> AddExecutable(this IDistributedApplicationBuilder builder, [ResourceName] string name, string command, string workingDirectory, params string[]? args)
41/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
42public static IResourceBuilder<ExecutableResource> AddExecutable(this IDistributedApplicationBuilder builder, [ResourceName] string name, string command, string workingDirectory, params object[]? args)
67/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
68public static IResourceBuilder<T> PublishAsDockerFile<T>(this IResourceBuilder<T> builder) where T : ExecutableResource
81/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
83public static IResourceBuilder<T> PublishAsDockerFile<T>(this IResourceBuilder<T> builder, IEnumerable<DockerBuildArg>? buildArgs) where T : ExecutableResource
109/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
110public static IResourceBuilder<T> PublishAsDockerFile<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<ContainerResource>>? configure)
128var cb = builder.ApplicationBuilder.AddResource(container);
ParameterResourceBuilderExtensions.cs (14)
22public static IResourceBuilder<ParameterResource> AddParameter(this IDistributedApplicationBuilder builder, [ResourceName] string name, bool secret = false)
47public static IResourceBuilder<ParameterResource> AddParameter(this IDistributedApplicationBuilder builder, [ResourceName] string name, string value, bool publishValueAsDefault = false, bool secret = false)
68public static IResourceBuilder<ParameterResource> AddParameter(this IDistributedApplicationBuilder builder, string name, Func<string> valueGetter, bool publishValueAsDefault = false, bool secret = false)
101public static IResourceBuilder<ParameterResource> AddParameterFromConfiguration(this IDistributedApplicationBuilder builder, string name, string configurationKey, bool secret = false)
131public static IResourceBuilder<ParameterResource> AddParameter(this IDistributedApplicationBuilder builder, [ResourceName] string name, ParameterDefault value, bool secret = false, bool persist = false)
158internal static IResourceBuilder<T> AddParameter<T>(this IDistributedApplicationBuilder builder, T resource)
176/// Adds a parameter to the distributed application but wrapped in a resource with a connection string for use with <see cref="ResourceBuilderExtensions.WithReference{TDestination}(IResourceBuilder{TDestination}, IResourceBuilder{IResourceWithConnectionString}, string?, bool)"/>
183public static IResourceBuilder<IResourceWithConnectionString> AddConnectionString(this IDistributedApplicationBuilder builder, [ResourceName] string name, string? environmentVariableName = null)
202/// <returns>The configured <see cref="IResourceBuilder{T}"/>.</returns>
203public static IResourceBuilder<T> PublishAsConnectionString<T>(this IResourceBuilder<T> builder)
215/// <param name="builder">The <see cref="IResourceBuilder{T}"/>.</param>
216public static void ConfigureConnectionStringManifestPublisher(IResourceBuilder<IResourceWithConnectionString> builder)
ProjectResourceBuilderExtensions.cs (34)
28/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
61public static IResourceBuilder<ProjectResource> AddProject<TProject>(this IDistributedApplicationBuilder builder, [ResourceName] string name) where TProject : IProjectMetadata, new()
75/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
94public static IResourceBuilder<ProjectResource> AddProject(this IDistributedApplicationBuilder builder, [ResourceName] string name, string projectPath)
111/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
141public static IResourceBuilder<ProjectResource> AddProject<TProject>(this IDistributedApplicationBuilder builder, [ResourceName] string name, string? launchProfileName) where TProject : IProjectMetadata, new()
160/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
179public static IResourceBuilder<ProjectResource> AddProject(this IDistributedApplicationBuilder builder, [ResourceName] string name, string projectPath, string? launchProfileName)
199/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
228public static IResourceBuilder<ProjectResource> AddProject<TProject>(this IDistributedApplicationBuilder builder, [ResourceName] string name, Action<ProjectResourceOptions> configure) where TProject : IProjectMetadata, new()
250/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
268public static IResourceBuilder<ProjectResource> AddProject(this IDistributedApplicationBuilder builder, [ResourceName] string name, string projectPath, Action<ProjectResourceOptions> configure)
287private static IResourceBuilder<ProjectResource> WithProjectDefaults(this IResourceBuilder<ProjectResource> builder, ProjectResourceOptions options)
574/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
579/// reverse proxy for each process. When <see cref="WithReplicas(IResourceBuilder{ProjectResource}, int)"/> is
596public static IResourceBuilder<ProjectResource> WithReplicas(this IResourceBuilder<ProjectResource> builder, int replicas)
608/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
617/// into the project and set to true. If the <see cref="DisableForwardedHeaders(IResourceBuilder{ProjectResource})"/>
630public static IResourceBuilder<ProjectResource> DisableForwardedHeaders(this IResourceBuilder<ProjectResource> builder)
644/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
645public static IResourceBuilder<ProjectResource> WithEndpointsInEnvironment(
646this IResourceBuilder<ProjectResource> builder, Func<EndpointAnnotation, bool> filter)
669/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
670public static IResourceBuilder<T> PublishAsDockerFile<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<ContainerResource>>? configure = null)
688var cb = builder.ApplicationBuilder.AddResource(container);
730private static void SetAspNetCoreUrls(this IResourceBuilder<ProjectResource> builder)
777private static void SetBothPortsEnvVariables(this IResourceBuilder<ProjectResource> builder)
786private static void SetOnePortsEnvVariable(this IResourceBuilder<ProjectResource> builder, EnvironmentCallbackContext context, string portEnvVariable, string scheme)
821private static void SetKestrelUrlOverrideEnvVariables(this IResourceBuilder<ProjectResource> builder)
ResourceBuilderExtensions.cs (196)
31/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
32public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, string? value) where T : IResourceWithEnvironment
47/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
48public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, in ReferenceExpression.ExpressionInterpolatedStringHandler value)
71/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
72public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, ReferenceExpression value)
94/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
95public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, Func<string> callback) where T : IResourceWithEnvironment
110/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
111public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, Action<EnvironmentCallbackContext> callback) where T : IResourceWithEnvironment
125/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
126public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, Func<EnvironmentCallbackContext, Task> callback) where T : IResourceWithEnvironment
141/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
142public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, EndpointReference endpointReference) where T : IResourceWithEnvironment
163/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
164public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, IResourceBuilder<ParameterResource> parameter) where T : IResourceWithEnvironment
185/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
186public static IResourceBuilder<T> WithEnvironment<T>(
187this IResourceBuilder<T> builder,
189IResourceBuilder<IResourceWithConnectionString> resource)
210/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
211public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, params string[] args) where T : IResourceWithArgs
225/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
226public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, params object[] args) where T : IResourceWithArgs
242/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
243public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, Action<CommandLineArgsCallbackContext> callback) where T : IResourceWithArgs
261/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
262public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, Func<CommandLineArgsCallbackContext, Task> callback) where T : IResourceWithArgs
276/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
277public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Action<ManifestPublishingContext> callback) where T : IResource
292/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
293public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
308/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
309public static IResourceBuilder<T> WithConnectionStringRedirection<T>(this IResourceBuilder<T> builder, IResourceWithConnectionString resource) where T : IResourceWithConnectionString
357/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
358public static IResourceBuilder<TDestination> WithReference<TDestination>(this IResourceBuilder<TDestination> builder, IResourceBuilder<IResourceWithConnectionString> source, string? connectionName = null, bool optional = false)
384/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
385public static IResourceBuilder<TDestination> WithReference<TDestination>(this IResourceBuilder<TDestination> builder, IResourceBuilder<IResourceWithServiceDiscovery> source)
403/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
404public static IResourceBuilder<TDestination> WithReference<TDestination>(this IResourceBuilder<TDestination> builder, string name, Uri uri)
431/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
432public static IResourceBuilder<TDestination> WithReference<TDestination>(this IResourceBuilder<TDestination> builder, EndpointReference endpointReference)
442private static void ApplyEndpoints<T>(this IResourceBuilder<T> builder, IResourceWithEndpoints resourceWithEndpoints, string? endpointName = null)
483/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
486/// The <see cref="WithEndpoint{T}(IResourceBuilder{T}, string, Action{EndpointAnnotation}, bool)"/> method allows
507public static IResourceBuilder<T> WithEndpoint<T>(this IResourceBuilder<T> builder, [EndpointName] string endpointName, Action<EndpointAnnotation> callback, bool createIfNotExists = true) where T : IResourceWithEndpoints
538/// Exposes an endpoint on a resource. This endpoint reference can be retrieved using <see cref="ResourceBuilderExtensions.GetEndpoint{T}(IResourceBuilder{T}, string)"/>.
551/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
554public static IResourceBuilder<T> WithEndpoint<T>(this IResourceBuilder<T> builder, int? port = null, int? targetPort = null, string? scheme = null, [EndpointName] string? name = null, string? env = null, bool isProxied = true, bool? isExternal = null, ProtocolType? protocol = null) where T : IResourceWithEndpoints
589/// Exposes an endpoint on a resource. This endpoint reference can be retrieved using <see cref="ResourceBuilderExtensions.GetEndpoint{T}(IResourceBuilder{T}, string)"/>.
601/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
603public static IResourceBuilder<T> WithEndpoint<T>(this IResourceBuilder<T> builder, int? port, int? targetPort, string? scheme, [EndpointName] string? name, string? env, bool isProxied, bool? isExternal) where T : IResourceWithEndpoints
609/// Exposes an HTTP endpoint on a resource. This endpoint reference can be retrieved using <see cref="ResourceBuilderExtensions.GetEndpoint{T}(IResourceBuilder{T}, string)"/>.
619/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
621public static IResourceBuilder<T> WithHttpEndpoint<T>(this IResourceBuilder<T> builder, int? port = null, int? targetPort = null, [EndpointName] string? name = null, string? env = null, bool isProxied = true) where T : IResourceWithEndpoints
629/// Exposes an HTTPS endpoint on a resource. This endpoint reference can be retrieved using <see cref="ResourceBuilderExtensions.GetEndpoint{T}(IResourceBuilder{T}, string)"/>.
639/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
641public static IResourceBuilder<T> WithHttpsEndpoint<T>(this IResourceBuilder<T> builder, int? port = null, int? targetPort = null, [EndpointName] string? name = null, string? env = null, bool isProxied = true) where T : IResourceWithEndpoints
653/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
654public static IResourceBuilder<T> WithExternalHttpEndpoints<T>(this IResourceBuilder<T> builder) where T : IResourceWithEndpoints
675/// Gets an <see cref="EndpointReference"/> by name from the resource. These endpoints are declared either using <see cref="WithEndpoint{T}(IResourceBuilder{T}, int?, int?, string?, string?, string?, bool, bool?, ProtocolType?)"/> or by launch settings (for project resources).
676/// The <see cref="EndpointReference"/> can be used to resolve the address of the endpoint in <see cref="WithEnvironment{T}(IResourceBuilder{T}, Action{EnvironmentCallbackContext})"/>.
682public static EndpointReference GetEndpoint<T>(this IResourceBuilder<T> builder, [EndpointName] string name) where T : IResourceWithEndpoints
694/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
695public static IResourceBuilder<T> AsHttp2Service<T>(this IResourceBuilder<T> builder) where T : IResourceWithEndpoints
708/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
749public static IResourceBuilder<T> WithUrls<T>(this IResourceBuilder<T> builder, Action<ResourceUrlsCallbackContext> callback)
764/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
772public static IResourceBuilder<T> WithUrls<T>(this IResourceBuilder<T> builder, Func<ResourceUrlsCallbackContext, Task> callback)
788/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
793public static IResourceBuilder<T> WithUrl<T>(this IResourceBuilder<T> builder, string url, string? displayText = null)
809/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
814public static IResourceBuilder<T> WithUrl<T>(this IResourceBuilder<T> builder, in ReferenceExpression.ExpressionInterpolatedStringHandler url, string? displayText = null)
831/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
836public static IResourceBuilder<T> WithUrl<T>(this IResourceBuilder<T> builder, ReferenceExpression url, string? displayText = null)
860/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
864/// To add another URL for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Func{EndpointReference, ResourceUrlAnnotation})"/>.
891public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Action<ResourceUrlAnnotation> callback)
917/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
921/// To customize the URL that is automatically added for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Action{ResourceUrlAnnotation})"/>.
937public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Func<EndpointReference, ResourceUrlAnnotation> callback)
962/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
963public static IResourceBuilder<T> ExcludeFromManifest<T>(this IResourceBuilder<T> builder) where T : IResource
976/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
981/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> also results
984/// <para>The <see cref="WithHealthCheck{T}(IResourceBuilder{T}, string)"/> method can be used to associate
997public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResourceWithWaitSupport
1012/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1017/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results
1020/// <para>The <see cref="WithHealthCheck{T}(IResourceBuilder{T}, string)"/> method can be used to associate
1025/// behavior with the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> overload.</para>
1039public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport
1047private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
1064var parentBuilder = builder.ApplicationBuilder.CreateResourceBuilder(dependencyResourceWithParent.Parent);
1094/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1109public static IResourceBuilder<T> WithExplicitStart<T>(this IResourceBuilder<T> builder) where T : IResource
1121/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1140public static IResourceBuilder<T> WaitForCompletion<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, int exitCode = 0) where T : IResourceWithWaitSupport
1166/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1169/// The <see cref="WithHealthCheck{T}(IResourceBuilder{T}, string)"/> method is used in conjunction with
1170/// the <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/> to associate a resource
1171/// registered in the application hosts dependency injection container. The <see cref="WithHealthCheck{T}(IResourceBuilder{T}, string)"/>
1196public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> builder, string key) where T : IResource
1219/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1240public static IResourceBuilder<T> WithHttpHealthCheck<T>(this IResourceBuilder<T> builder, string? path = null, int? statusCode = null, string? endpointName = null) where T : IResourceWithEndpoints
1253internal static IResourceBuilder<T> WithHttpHealthCheckInternal<T>(this IResourceBuilder<T> builder, string desiredScheme, string endpointName, string? path = null, int? statusCode = null) where T : IResourceWithEndpoints
1314/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1335public static IResourceBuilder<T> WithHttpsHealthCheck<T>(this IResourceBuilder<T> builder, string? path = null, int? statusCode = null, string? endpointName = null) where T : IResourceWithEndpoints
1359/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1365public static IResourceBuilder<T> WithCommand<T>(
1366this IResourceBuilder<T> builder,
1419/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1426public static IResourceBuilder<T> WithCommand<T>(
1427this IResourceBuilder<T> builder,
1464/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1527public static IResourceBuilder<TResource> WithHttpCommand<TResource>(
1528this IResourceBuilder<TResource> builder,
1554/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
1600public static IResourceBuilder<TResource> WithHttpCommand<TResource>(
1601this IResourceBuilder<TResource> builder,
1704private static Func<EndpointReference> NamedEndpointSelector<TResource>(IResourceBuilder<TResource> builder, string[] endpointNames)
1730private static Func<EndpointReference> DefaultEndpointSelector<TResource>(IResourceBuilder<TResource> builder)
1773public static IResourceBuilder<T> WithRelationship<T>(
1774this IResourceBuilder<T> builder,
1792public static IResourceBuilder<T> WithReferenceRelationship<T>(
1793this IResourceBuilder<T> builder,
1809public static IResourceBuilder<T> WithReferenceRelationship<T>(
1810this IResourceBuilder<T> builder,
1821private static void WalkAndLinkResourceReferences<T>(IResourceBuilder<T> builder, IEnumerable<object> values)
1842else if (value is IResourceBuilder<IResource> resourceBuilder)
1868public static IResourceBuilder<T> WithReferenceRelationship<T>(
1869this IResourceBuilder<T> builder,
1870IResourceBuilder<IResource> resourceBuilder) where T : IResource
1901public static IResourceBuilder<T> WithParentRelationship<T>(
1902this IResourceBuilder<T> builder,
1903IResourceBuilder<IResource> parent) where T : IResource
1931public static IResourceBuilder<T> WithParentRelationship<T>(
1932this IResourceBuilder<T> builder,
1943/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
1948public static IResourceBuilder<T> WithComputeEnvironment<T>(this IResourceBuilder<T> builder, IResourceBuilder<IComputeEnvironmentResource> computeEnvironmentResource)
Aspire.Hosting.Azure (75)
AzureBicepResourceExtensions.cs (50)
22/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
23public static IResourceBuilder<AzureBicepResource> AddBicepTemplate(this IDistributedApplicationBuilder builder, [ResourceName] string name, string bicepFile)
38/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
39public static IResourceBuilder<AzureBicepResource> AddBicepTemplateString(this IDistributedApplicationBuilder builder, [ResourceName] string name, string bicepContent)
53public static BicepOutputReference GetOutput(this IResourceBuilder<AzureBicepResource> builder, string name)
64public static BicepSecretOutputReference GetSecretOutput(this IResourceBuilder<AzureBicepResource> builder, string name)
76/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
77public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, BicepOutputReference bicepOutputReference)
95/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
96public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, BicepSecretOutputReference bicepOutputReference)
112/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
113public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, IAzureKeyVaultSecretReference secretReference)
128/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
129public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name)
144/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
145public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, string value)
160/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
161public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, IEnumerable<string> value)
176/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
177public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, JsonNode value)
192/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
193public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, Func<object?> valueCallback)
208/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
209public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, IResourceBuilder<ParameterResource> value)
222/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
223public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, ParameterResource value)
241/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
242public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, IResourceBuilder<IResourceWithConnectionString> value)
260/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
261public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, BicepOutputReference value)
279/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
280public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, ReferenceExpression value)
298/// <returns>An <see cref="IResourceBuilder{T}"/>.</returns>
299public static IResourceBuilder<T> WithParameter<T>(this IResourceBuilder<T> builder, string name, EndpointReference value)
ExistingAzureResourceExtensions.cs (16)
35public static IResourceBuilder<T> RunAsExisting<T>(this IResourceBuilder<T> builder, IResourceBuilder<ParameterResource> nameParameter, IResourceBuilder<ParameterResource>? resourceGroupParameter)
56public static IResourceBuilder<T> RunAsExisting<T>(this IResourceBuilder<T> builder, string name, string? resourceGroup)
77public static IResourceBuilder<T> PublishAsExisting<T>(this IResourceBuilder<T> builder, IResourceBuilder<ParameterResource> nameParameter, IResourceBuilder<ParameterResource>? resourceGroupParameter)
98public static IResourceBuilder<T> PublishAsExisting<T>(this IResourceBuilder<T> builder, string name, string? resourceGroup)
119public static IResourceBuilder<T> AsExisting<T>(this IResourceBuilder<T> builder, IResourceBuilder<ParameterResource> nameParameter, IResourceBuilder<ParameterResource>? resourceGroupParameter)
Aspire.Hosting.Azure.AppConfiguration (13)
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.AppContainers (23)
ContainerAppExtensions.cs (12)
26/// <para>The <see cref="ConfigureCustomDomain(ContainerApp, IResourceBuilder{ParameterResource}, IResourceBuilder{ParameterResource})"/> extension method
28/// <para>The <see cref="ConfigureCustomDomain(ContainerApp, IResourceBuilder{ParameterResource}, IResourceBuilder{ParameterResource})"/> method is used
29/// in conjunction with the <see cref="AzureContainerAppContainerExtensions.PublishAsAzureContainerApp{T}(IResourceBuilder{T}, Action{AzureResourceInfrastructure, ContainerApp})"/>
31/// <para>The <see cref="ConfigureCustomDomain(ContainerApp, IResourceBuilder{ParameterResource}, IResourceBuilder{ParameterResource})"/> method takes
43/// passing them to the <see cref="ConfigureCustomDomain(ContainerApp, IResourceBuilder{ParameterResource}, IResourceBuilder{ParameterResource})"/>
44/// method via the <see cref="AzureContainerAppContainerExtensions.PublishAsAzureContainerApp{T}(IResourceBuilder{T}, Action{AzureResourceInfrastructure, ContainerApp})"/>
58public static void ConfigureCustomDomain(this ContainerApp app, IResourceBuilder<ParameterResource> customDomain, IResourceBuilder<ParameterResource> certificateName)
Aspire.Hosting.Azure.ApplicationInsights (5)
Aspire.Hosting.Azure.CognitiveServices (22)
AzureOpenAIExtensions.cs (17)
22/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
28/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureOpenAIResource}, CognitiveServicesBuiltInRole[])"/>.
30public static IResourceBuilder<AzureOpenAIResource> AddAzureOpenAI(this IDistributedApplicationBuilder builder, [ResourceName] string name)
145/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
147public static IResourceBuilder<AzureOpenAIResource> AddDeployment(this IResourceBuilder<AzureOpenAIResource> builder, AzureOpenAIDeployment deployment)
164/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
165public static IResourceBuilder<AzureOpenAIDeploymentResource> AddDeployment(this IResourceBuilder<AzureOpenAIResource> builder, [ResourceName] string name, string modelName, string modelVersion)
183/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
184public static IResourceBuilder<AzureOpenAIDeploymentResource> WithProperties(this IResourceBuilder<AzureOpenAIDeploymentResource> builder, Action<AzureOpenAIDeploymentResource> configure)
201/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
214public static IResourceBuilder<T> WithRoleAssignments<T>(
215this IResourceBuilder<T> builder,
216IResourceBuilder<AzureOpenAIResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.CosmosDB (41)
AzureCosmosDBExtensions.cs (39)
30/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
31public static IResourceBuilder<AzureCosmosDBResource> AddAzureCosmosDB(this IDistributedApplicationBuilder builder, [ResourceName] string name)
49/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
55public static IResourceBuilder<AzureCosmosDBResource> RunAsEmulator(this IResourceBuilder<AzureCosmosDBResource> builder, Action<IResourceBuilder<AzureCosmosDBEmulatorResource>>? configureContainer = null)
64/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
69public static IResourceBuilder<AzureCosmosDBResource> RunAsPreviewEmulator(this IResourceBuilder<AzureCosmosDBResource> builder, Action<IResourceBuilder<AzureCosmosDBEmulatorResource>>? configureContainer = null)
72private static IResourceBuilder<AzureCosmosDBResource> RunAsEmulator(this IResourceBuilder<AzureCosmosDBResource> builder, Action<IResourceBuilder<AzureCosmosDBEmulatorResource>>? configureContainer, bool useVNextPreview)
136var surrogateBuilder = builder.ApplicationBuilder.CreateResourceBuilder(surrogate);
170public static IResourceBuilder<AzureCosmosDBEmulatorResource> WithDataVolume(this IResourceBuilder<AzureCosmosDBEmulatorResource> builder, string? name = null)
186public static IResourceBuilder<AzureCosmosDBEmulatorResource> WithGatewayPort(this IResourceBuilder<AzureCosmosDBEmulatorResource> builder, int? port)
205public static IResourceBuilder<AzureCosmosDBEmulatorResource> WithPartitionCount(this IResourceBuilder<AzureCosmosDBEmulatorResource> builder, int count)
227/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
229public static IResourceBuilder<AzureCosmosDBResource> AddDatabase(this IResourceBuilder<AzureCosmosDBResource> builder, string databaseName)
245/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
246public static IResourceBuilder<AzureCosmosDBDatabaseResource> AddCosmosDatabase(this IResourceBuilder<AzureCosmosDBResource> builder, [ResourceName] string name, string? databaseName = null)
267/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
268public static IResourceBuilder<AzureCosmosDBContainerResource> AddContainer(this IResourceBuilder<AzureCosmosDBDatabaseResource> builder, [ResourceName] string name, string partitionKeyPath, string? containerName = null)
293public static IResourceBuilder<AzureCosmosDBEmulatorResource> WithDataExplorer(this IResourceBuilder<AzureCosmosDBEmulatorResource> builder, int? port = null)
323/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
338public static IResourceBuilder<AzureCosmosDBResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureCosmosDBResource> builder)
342var kv = builder.ApplicationBuilder.AddAzureKeyVault($"{builder.Resource.Name}-kv")
367/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
368public static IResourceBuilder<AzureCosmosDBResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureCosmosDBResource> builder, IResourceBuilder<IAzureKeyVaultResource> keyVaultBuilder)
Aspire.Hosting.Azure.EventHubs (47)
AzureEventHubsExtensions.cs (40)
30/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
36/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureEventHubsResource}, EventHubsBuiltInRole[])"/>.
38public static IResourceBuilder<AzureEventHubsResource> AddAzureEventHubs(
107/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
109public static IResourceBuilder<AzureEventHubsResource> AddEventHub(this IResourceBuilder<AzureEventHubsResource> builder, [ResourceName] string name)
125/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
126public static IResourceBuilder<AzureEventHubResource> AddHub(this IResourceBuilder<AzureEventHubsResource> builder, [ResourceName] string name, string? hubName = null)
145/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
146public static IResourceBuilder<AzureEventHubResource> WithProperties(this IResourceBuilder<AzureEventHubResource> builder, Action<AzureEventHubResource> configure)
162/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
163public static IResourceBuilder<AzureEventHubConsumerGroupResource> AddConsumerGroup(
164this IResourceBuilder<AzureEventHubResource> builder,
188/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
208public static IResourceBuilder<AzureEventHubsResource> RunAsEmulator(this IResourceBuilder<AzureEventHubsResource> builder, Action<IResourceBuilder<AzureEventHubsEmulatorResource>>? configureContainer = null)
232var storageResource = builder.ApplicationBuilder
243var surrogateBuilder = builder.ApplicationBuilder.CreateResourceBuilder(surrogate);
379public static IResourceBuilder<AzureEventHubsEmulatorResource> WithDataBindMount(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, string? path = null)
393public static IResourceBuilder<AzureEventHubsEmulatorResource> WithDataVolume(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, string? name = null)
407public static IResourceBuilder<AzureEventHubsEmulatorResource> WithGatewayPort(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, int? port)
420public static IResourceBuilder<AzureEventHubsEmulatorResource> WithHostPort(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, int? port)
435/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
436public static IResourceBuilder<AzureEventHubsEmulatorResource> WithConfigurationFile(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, string path)
456/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
457public static IResourceBuilder<AzureEventHubsEmulatorResource> WithConfiguration(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, Action<JsonNode> configJson)
512/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
525public static IResourceBuilder<T> WithRoleAssignments<T>(
526this IResourceBuilder<T> builder,
527IResourceBuilder<AzureEventHubsResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.Functions (16)
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.KeyVault (13)
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.OperationalInsights (2)
Aspire.Hosting.Azure.PostgreSQL (41)
AzurePostgresExtensions.cs (41)
19private static IResourceBuilder<T> WithLoginAndPassword<T>(this IResourceBuilder<T> builder, PostgresServerResource postgresResource)
32private static IResourceBuilder<PostgresServerResource> PublishAsAzurePostgresFlexibleServerInternal(
33this IResourceBuilder<PostgresServerResource> builder,
72var resourceBuilder = builder.ApplicationBuilder.CreateResourceBuilder(resource)
95/// <param name="builder">The <see cref="IResourceBuilder{PostgresServerResource}"/> builder.</param>
96/// <returns>A reference to the <see cref="IResourceBuilder{PostgresServerResource}"/> builder.</returns>
98public static IResourceBuilder<PostgresServerResource> PublishAsAzurePostgresFlexibleServer(this IResourceBuilder<PostgresServerResource> builder)
104/// <param name="builder">The <see cref="IResourceBuilder{PostgresServerResource}"/> builder.</param>
105/// <returns>A reference to the <see cref="IResourceBuilder{PostgresServerResource}"/> builder.</returns>
107public static IResourceBuilder<PostgresServerResource> AsAzurePostgresFlexibleServer(this IResourceBuilder<PostgresServerResource> builder)
115/// <returns>A reference to the <see cref="IResourceBuilder{AzurePostgresFlexibleServerResource}"/> builder.</returns>
121/// You can use the <see cref="WithPasswordAuthentication(IResourceBuilder{AzurePostgresFlexibleServerResource}, IResourceBuilder{IAzureKeyVaultResource}, IResourceBuilder{ParameterResource}?, IResourceBuilder{ParameterResource}?)"/> method to configure the resource to use password authentication.
136public static IResourceBuilder<AzurePostgresFlexibleServerResource> AddAzurePostgresFlexibleServer(this IDistributedApplicationBuilder builder, [ResourceName] string name)
154/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
155public static IResourceBuilder<AzurePostgresFlexibleServerDatabaseResource> AddDatabase(this IResourceBuilder<AzurePostgresFlexibleServerResource> builder, [ResourceName] string name, string? databaseName = null)
175var innerBuilder = builder.ApplicationBuilder.CreateResourceBuilder(azureResource.InnerResource);
189/// <returns>A reference to the <see cref="IResourceBuilder{AzurePostgresFlexibleServerResource}"/> builder.</returns>
205public static IResourceBuilder<AzurePostgresFlexibleServerResource> RunAsContainer(this IResourceBuilder<AzurePostgresFlexibleServerResource> builder, Action<IResourceBuilder<PostgresServerResource>>? configureContainer = null)
229var postgresContainer = builder.ApplicationBuilder.AddPostgres(
267/// <returns>A reference to the <see cref="IResourceBuilder{AzurePostgresFlexibleServerResource}"/> builder.</returns>
282public static IResourceBuilder<AzurePostgresFlexibleServerResource> WithPasswordAuthentication(
283this IResourceBuilder<AzurePostgresFlexibleServerResource> builder,
284IResourceBuilder<ParameterResource>? userName = null,
285IResourceBuilder<ParameterResource>? password = null)
289var kv = builder.ApplicationBuilder.AddAzureKeyVault($"{builder.Resource.Name}-kv")
317/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
318public static IResourceBuilder<AzurePostgresFlexibleServerResource> WithPasswordAuthentication(
319this IResourceBuilder<AzurePostgresFlexibleServerResource> builder,
320IResourceBuilder<IAzureKeyVaultResource> keyVaultBuilder,
321IResourceBuilder<ParameterResource>? userName = null,
322IResourceBuilder<ParameterResource>? password = null)
520private static ParameterResource CreateDefaultUserNameParameter<T>(IResourceBuilder<T> builder) where T : AzureBicepResource
Aspire.Hosting.Azure.Redis (28)
Aspire.Hosting.Azure.Search (13)
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.ServiceBus (62)
AzureServiceBusExtensions.cs (53)
31/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
37/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureServiceBusResource}, ServiceBusBuiltInRole[])"/>.
39public static IResourceBuilder<AzureServiceBusResource> AddAzureServiceBus(this IDistributedApplicationBuilder builder, [ResourceName] string name)
121/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
123public static IResourceBuilder<AzureServiceBusResource> AddQueue(this IResourceBuilder<AzureServiceBusResource> builder, [ResourceName] string name)
139/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
140public static IResourceBuilder<AzureServiceBusQueueResource> AddServiceBusQueue(this IResourceBuilder<AzureServiceBusResource> builder, [ResourceName] string name, string? queueName = null)
159/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
160public static IResourceBuilder<AzureServiceBusQueueResource> WithProperties(this IResourceBuilder<AzureServiceBusQueueResource> builder, Action<AzureServiceBusQueueResource> configure)
176public static IResourceBuilder<AzureServiceBusResource> AddTopic(this IResourceBuilder<AzureServiceBusResource> builder, [ResourceName] string name)
193public static IResourceBuilder<AzureServiceBusResource> AddTopic(this IResourceBuilder<AzureServiceBusResource> builder, [ResourceName] string name, string[] subscriptions)
199var topic = builder.AddServiceBusTopic(name);
216/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
217public static IResourceBuilder<AzureServiceBusTopicResource> AddServiceBusTopic(this IResourceBuilder<AzureServiceBusResource> builder, [ResourceName] string name, string? topicName = null)
236/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
237public static IResourceBuilder<AzureServiceBusTopicResource> WithProperties(this IResourceBuilder<AzureServiceBusTopicResource> builder, Action<AzureServiceBusTopicResource> configure)
253/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
255public static IResourceBuilder<AzureServiceBusResource> AddSubscription(this IResourceBuilder<AzureServiceBusResource> builder, string topicName, string subscriptionName)
261IResourceBuilder<AzureServiceBusTopicResource> topicBuilder;
282/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
283public static IResourceBuilder<AzureServiceBusSubscriptionResource> AddServiceBusSubscription(this IResourceBuilder<AzureServiceBusTopicResource> builder, [ResourceName] string name, string? subscriptionName = null)
302/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
303public static IResourceBuilder<AzureServiceBusSubscriptionResource> WithProperties(this IResourceBuilder<AzureServiceBusSubscriptionResource> builder, Action<AzureServiceBusSubscriptionResource> configure)
321/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
338public static IResourceBuilder<AzureServiceBusResource> RunAsEmulator(this IResourceBuilder<AzureServiceBusResource> builder, Action<IResourceBuilder<AzureServiceBusEmulatorResource>>? configureContainer = null)
366var sqlEdgeResource = builder.ApplicationBuilder
393var surrogateBuilder = builder.ApplicationBuilder.CreateResourceBuilder(surrogate);
526/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
527public static IResourceBuilder<AzureServiceBusEmulatorResource> WithConfigurationFile(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, string path)
547/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
562public static IResourceBuilder<AzureServiceBusEmulatorResource> WithConfiguration(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, Action<JsonNode> configJson)
577/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
578public static IResourceBuilder<AzureServiceBusEmulatorResource> WithHostPort(this IResourceBuilder<AzureServiceBusEmulatorResource> builder, int? port)
662/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
675public static IResourceBuilder<T> WithRoleAssignments<T>(
676this IResourceBuilder<T> builder,
677IResourceBuilder<AzureServiceBusResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.SignalR (22)
AzureSignalRExtensions.cs (17)
24/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
30/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureSignalRResource}, SignalRBuiltInRole[])"/>.
32public static IResourceBuilder<AzureSignalRResource> AddAzureSignalR(this IDistributedApplicationBuilder builder, [ResourceName] string name)
41/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
51/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureSignalRResource}, SignalRBuiltInRole[])"/>.
53public static IResourceBuilder<AzureSignalRResource> AddAzureSignalR(this IDistributedApplicationBuilder builder, [ResourceName] string name, AzureSignalRServiceMode serviceMode)
114/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
115public static IResourceBuilder<AzureSignalRResource> RunAsEmulator(this IResourceBuilder<AzureSignalRResource> builder, Action<IResourceBuilder<AzureSignalREmulatorResource>>? configureContainer = null)
135var surrogateBuilder = builder.ApplicationBuilder.CreateResourceBuilder(surrogate);
148/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
161public static IResourceBuilder<T> WithRoleAssignments<T>(
162this IResourceBuilder<T> builder,
163IResourceBuilder<AzureSignalRResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.Sql (23)
Aspire.Hosting.Azure.Storage (42)
AzureStorageExtensions.cs (37)
35/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureStorageResource}, StorageBuiltInRole[])"/>.
37public static IResourceBuilder<AzureStorageResource> AddAzureStorage(this IDistributedApplicationBuilder builder, [ResourceName] string name)
104/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
105public static IResourceBuilder<AzureStorageResource> RunAsEmulator(this IResourceBuilder<AzureStorageResource> builder, Action<IResourceBuilder<AzureStorageEmulatorResource>>? configureContainer = null)
179public static IResourceBuilder<AzureStorageEmulatorResource> WithDataBindMount(this IResourceBuilder<AzureStorageEmulatorResource> builder, string? path = null, bool isReadOnly = false)
193public static IResourceBuilder<AzureStorageEmulatorResource> WithDataVolume(this IResourceBuilder<AzureStorageEmulatorResource> builder, string? name = null, bool isReadOnly = false)
206public static IResourceBuilder<AzureStorageEmulatorResource> WithBlobPort(this IResourceBuilder<AzureStorageEmulatorResource> builder, int port)
222public static IResourceBuilder<AzureStorageEmulatorResource> WithQueuePort(this IResourceBuilder<AzureStorageEmulatorResource> builder, int port)
237/// <returns>An <see cref="IResourceBuilder{T}"/> for the <see cref="AzureStorageEmulatorResource"/>.</returns>
238public static IResourceBuilder<AzureStorageEmulatorResource> WithTablePort(this IResourceBuilder<AzureStorageEmulatorResource> builder, int port)
253/// <returns>An <see cref="IResourceBuilder{T}"/> for the <see cref="AzureStorageEmulatorResource"/>.</returns>
254public static IResourceBuilder<AzureStorageEmulatorResource> WithApiVersionCheck(this IResourceBuilder<AzureStorageEmulatorResource> builder, bool enable = true)
275/// <param name="builder">The <see cref="IResourceBuilder{T}"/> for <see cref="AzureStorageResource"/>/</param>
277/// <returns>An <see cref="IResourceBuilder{T}"/> for the <see cref="AzureBlobStorageResource"/>.</returns>
278public static IResourceBuilder<AzureBlobStorageResource> AddBlobs(this IResourceBuilder<AzureStorageResource> builder, [ResourceName] string name)
290/// <param name="builder">The <see cref="IResourceBuilder{T}"/> for <see cref="AzureStorageResource"/>/</param>
292/// <returns>An <see cref="IResourceBuilder{T}"/> for the <see cref="AzureTableStorageResource"/>.</returns>
293public static IResourceBuilder<AzureTableStorageResource> AddTables(this IResourceBuilder<AzureStorageResource> builder, [ResourceName] string name)
305/// <param name="builder">The <see cref="IResourceBuilder{T}"/> for <see cref="AzureStorageResource"/>/</param>
307/// <returns>An <see cref="IResourceBuilder{T}"/> for the <see cref="AzureQueueStorageResource"/>.</returns>
308public static IResourceBuilder<AzureQueueStorageResource> AddQueues(this IResourceBuilder<AzureStorageResource> builder, [ResourceName] string name)
324/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
338public static IResourceBuilder<T> WithRoleAssignments<T>(
339this IResourceBuilder<T> builder,
340IResourceBuilder<AzureStorageResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Azure.Tests (559)
AzureBicepResourceTests.cs (87)
32var bicepResource = builder.AddBicepTemplateString("mytemplate", "content")
41public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensions =>
44private static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> CreateAllAzureExtensions(string resourceName)
83public void AzureExtensionsAutomaticallyAddAzureProvisioning(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
95public void BicepResourcesAreIdempotent(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
98var azureResourceBuilder = addAzureResource(builder);
111public static TheoryData<Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>>> AzureExtensionsWithHyphen =>
116public void AzureResourcesProduceValidBicep(Func<IDistributedApplicationBuilder, IResourceBuilder<IResource>> addAzureResource)
119var azureResourceBuilder = addAzureResource(builder);
137var bicepResource = builder.AddBicepTemplateString("templ", "content");
149var bicepResource = builder.AddBicepTemplateString("templ", "content");
161var bicepResource = builder.AddBicepTemplateString("templ", "content");
171var bicepResource = builder.AddBicepTemplateString("templ", "content");
181var param = builder.AddParameter("p1");
183var b2 = builder.AddBicepTemplateString("temp2", "content");
225var cosmos = builder.AddAzureCosmosDB("cosmos").RunAsEmulator(e =>
267var cosmos = builder.AddAzureCosmosDB("cosmos")
283var db = cosmos.AddCosmosDatabase("db", databaseName: "mydatabase");
434var cosmos = builder.AddAzureCosmosDB("cosmos")
439var db = cosmos.AddCosmosDatabase("mydatabase");
537var cosmos = builder.AddAzureCosmosDB("cosmos")
553var db = cosmos.AddCosmosDatabase("mydatabase");
556var kv = builder.CreateResourceBuilder<AzureKeyVaultResource>(kvName);
697var cosmos = builder.AddAzureCosmosDB("cosmos")
702var db = cosmos.AddCosmosDatabase("mydatabase");
795var appConfig = builder.AddAzureAppConfiguration("appConfig");
876var appInsights = builder.AddAzureApplicationInsights("appInsights");
933var appInsights = builder.AddAzureApplicationInsights("appInsights");
998var law = builder.AddAzureLogAnalyticsWorkspace("mylaw");
999var appInsights = builder.AddAzureApplicationInsights("appInsights", law);
1056var logAnalyticsWorkspace = builder.AddAzureLogAnalyticsWorkspace("logAnalyticsWorkspace");
1098var appInsights = builder.AddAzureApplicationInsights("ai");
1102var serviceA = builder.AddProject<ProjectA>("serviceA", o => o.ExcludeLaunchProfile = true)
1115var infrastructure1 = builder.AddAzureInfrastructure("infrastructure1", (infrastructure) =>
1137var skuName = builder.AddParameter("skuName");
1140var infrastructure1 = builder.AddAzureInfrastructure("infrastructure1", (infrastructure) =>
1176var skuName = builder.AddParameter("skuName");
1179var infrastructure1 = builder.AddAzureInfrastructure("infrastructure1", (infrastructure) =>
1215var redis = builder.AddRedis("cache")
1284var sql = builder.AddSqlServer("sql").AsAzureSqlDatabase();
1380var sql = builder.AddSqlServer("sql").AsAzureSqlDatabase();
1465var usr = builder.AddParameter("usr");
1466var pwd = builder.AddParameter("pwd", secret: true);
1469var postgres = builder.AddPostgres("postgres", usr, pwd).AsAzurePostgresFlexibleServer();
1583var usr = builder.AddParameter("usr");
1584var pwd = builder.AddParameter("pwd", secret: true);
1587var postgres = builder.AddPostgres("postgres", usr, pwd).AsAzurePostgresFlexibleServer();
1692var usr = builder.AddParameter("usr");
1693var pwd = builder.AddParameter("pwd", secret: true);
1696var postgres = builder.AddPostgres("postgres", usr, pwd).PublishAsAzurePostgresFlexibleServer();
1729var postgres = builder.AddPostgres("postgres1")
1747var param = builder.AddParameter("param");
1793var serviceBus = builder.AddAzureServiceBus("sb");
1922var wps = builder.AddAzureWebPubSub("wps1");
2006var wps = builder.AddAzureWebPubSub("wps1")
2060var storage = builder.AddAzureStorage("storage").RunAsEmulator(e =>
2069var blob = storage.AddBlobs("blob");
2070var queue = storage.AddQueues("queue");
2071var table = storage.AddTables("table");
2098var storagesku = builder.AddParameter("storagesku");
2099var storage = builder.AddAzureStorage("storage")
2172var blob = storage.AddBlobs("blob");
2187var queue = storage.AddQueues("queue");
2202var table = storage.AddTables("table");
2222var storagesku = builder.AddParameter("storagesku");
2223var storage = builder.AddAzureStorage("storage")
2297var blob = storage.AddBlobs("blob");
2312var queue = storage.AddQueues("queue");
2327var table = storage.AddTables("table");
2347var storagesku = builder.AddParameter("storagesku");
2348var storage = builder.AddAzureStorage("storage")
2472var blob = storage.AddBlobs("blob");
2487var queue = storage.AddQueues("queue");
2502var table = storage.AddTables("table");
2522var storagesku = builder.AddParameter("storagesku");
2523var storage = builder.AddAzureStorage("storage")
2598var blob = storage.AddBlobs("blob");
2613var queue = storage.AddQueues("queue");
2628var table = storage.AddTables("table");
2649var sku = builder.AddParameter("searchSku");
2650var search = builder.AddAzureSearch("search")
2761var ai = builder.AddAzureApplicationInsights("ai").PublishAsConnectionString();
2762var serviceBus = builder.AddAzureServiceBus("servicebus").PublishAsConnectionString();
2764var serviceA = builder.AddProject<ProjectA>("serviceA", o => o.ExcludeLaunchProfile = true)
2791var openai = builder.AddAzureOpenAI("openai")
2943var provisioningResource = builder.AddAzureInfrastructure("infrastructure", r =>
2957var provisioningResource = builder.AddAzureInfrastructure("infrastructure", r =>
ExistingAzureResourceExtensionsTests.cs (25)
17var nameParameter = builder.AddParameter("name", "existingName");
18var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
20var serviceBus = builder.AddAzureServiceBus("sb")
31var nameParameter = builder.AddParameter("name", "existingName");
32var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
34var serviceBus = builder.AddAzureServiceBus("sb")
49var nameParameter = builder.AddParameter("name", "existingName");
50var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
51var nameParameter1 = builder.AddParameter("name1", "existingName");
52var resourceGroupParameter1 = builder.AddParameter("resourceGroup1", "existingResourceGroup");
54var serviceBus = builder.AddAzureServiceBus("sb")
70var nameParameter = builder.AddParameter("name", "existingName");
71var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
73var serviceBus = builder.AddAzureServiceBus("sb")
88var nameParameter = builder.AddParameter("name", "existingName");
89var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
90var nameParameter1 = builder.AddParameter("name1", "existingName");
91var resourceGroupParameter1 = builder.AddParameter("resourceGroup1", "existingResourceGroup");
93var serviceBus = builder.AddAzureServiceBus("sb")
104public static TheoryData<Func<string, string, string, IResourceBuilder<IAzureResource>>> AsExistingMethodsWithString =>
113public void CanCallAsExistingWithStringArguments(Func<string, string, string, IResourceBuilder<IAzureResource>> runAsExisting)
115var serviceBus = runAsExisting("existingName", "existingResourceGroup", "sb");
129var nameParameter = builder.AddParameter("name", "existingName");
130var resourceGroupParameter = builder.AddParameter("resourceGroup", "existingResourceGroup");
132var serviceBus = builder.AddAzureServiceBus("sb")
Aspire.Hosting.Azure.WebPubSub (23)
AzureWebPubSubExtensions.cs (18)
24/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
30/// These can be replaced by calling <see cref="WithRoleAssignments{T}(IResourceBuilder{T}, IResourceBuilder{AzureWebPubSubResource}, WebPubSubBuiltInRole[])"/>.
32public static IResourceBuilder<AzureWebPubSubResource> AddAzureWebPubSub(this IDistributedApplicationBuilder builder, [ResourceName] string name)
141public static IResourceBuilder<AzureWebPubSubHubResource> AddHub(this IResourceBuilder<AzureWebPubSubResource> builder, [ResourceName] string hubName)
152/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
153public static IResourceBuilder<AzureWebPubSubHubResource> AddHub(this IResourceBuilder<AzureWebPubSubResource> builder, [ResourceName] string name, string? hubName = null)
167var hubBuilder = builder.ApplicationBuilder.CreateResourceBuilder(hubResource);
181public static IResourceBuilder<AzureWebPubSubHubResource> AddEventHandler(
182this IResourceBuilder<AzureWebPubSubHubResource> builder,
206public static IResourceBuilder<AzureWebPubSubHubResource> AddEventHandler(
207this IResourceBuilder<AzureWebPubSubHubResource> builder,
249/// <returns>The updated <see cref="IResourceBuilder{T}"/> with the applied role assignments.</returns>
262public static IResourceBuilder<T> WithRoleAssignments<T>(
263this IResourceBuilder<T> builder,
264IResourceBuilder<AzureWebPubSubResource> target,
src\Shared\AzureRoleAssignmentUtils.cs (5)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
Aspire.Hosting.Containers.Tests (46)
ContainerResourceBuilderTests.cs (20)
16var redis = builder.AddContainer("redis", "redis").WithImage("redis-stack");
24var redis = builder.AddContainer("redis", "redis").WithImage("redis-stack", "1.0.0");
33var container = builder.AddContainer("app", "some-image");
45var container = builder.AddContainer("app", "some-image");
57var redis = builder.AddContainer("redis", "redis").WithImageTag("7.1");
65var redis = builder.AddContainer("redis", "redis").WithImageRegistry("myregistry.azurecr.io");
73var redis = builder.AddContainer("redis", "redis").WithImageSHA256("42b5c726e719639fcc1e9dbc13dd843f567dcd37911d0e1abb9f47f2cc1c95cd");
81var container = builder.AddResource(new TestContainerResource("testcontainer"));
91var container = builder.AddResource(new TestContainerResource("testcontainer"));
101var container = builder.AddResource(new TestContainerResource("testcontainer"));
119var container = builder.AddResource(new TestContainerResource("testcontainer"));
130var container = builder.AddResource(new TestContainerResource("testcontainer"));
139var container = builder.AddResource(new TestContainerResource("testcontainer"));
148var redis = builder
160var redis = builder
172var redis = builder
185var redis = builder
196var redis = builder
208var redis = builder
218private static void AssertImageComponents<T>(IResourceBuilder<T> builder, string? expectedRegistry, string expectedImage, string? expectedTag, string? expectedSha256)
WithDockerfileTests.cs (24)
29var parameter = builder.AddParameter("secret", secret: true);
98var dockerFile = builder.AddDockerfile(resourceName, tempContextPath, tempDockerfilePath);
116var dockerFile = builder.AddContainer(resourceName, "someimagename")
131var dockerFile = builder.AddContainer("testcontainer", "someimagename")
151var dockerFile = builder.AddContainer("testcontainer", "someimagename")
243var parameter = builder.AddParameter("message");
245var container = builder.AddContainer("testcontainer", "testimage")
291var parameter = builder.AddParameter("message");
293var container = builder.AddDockerfile("testcontainer", tempContextPath, tempDockerfilePath, "runner")
338var parameter = builder.AddParameter("secret", secret: true);
340var container = builder.AddContainer("testcontainer", "testimage")
384var parameter = builder.AddParameter("secret", secret: true);
386var container = builder.AddDockerfile("testcontainer", tempContextPath, tempDockerfilePath)
427var parameter = builder.AddParameter("message");
498var parameter = builder.AddParameter("message");
593var container = builder.AddContainer("mycontainer", "myimage");
614var container = builder.AddContainer("mycontainer", "myimage")
630var container = builder.AddDockerfile("mycontainer", tempContextPath);
645var container = builder.AddContainer("mycontainer", "myimage")
661var container = builder.AddDockerfile("mycontainer", tempContextPath, "Dockerfile");
676var container = builder.AddContainer("mycontainer", "myimage")
692var container = builder.AddDockerfile("mycontainer", tempContextPath, "Otherdockerfile");
707var container = builder.AddContainer("mycontainer", "myimage")
723var container = builder.AddDockerfile("mycontainer", tempContextPath, tempDockerfilePath);
Aspire.Hosting.Docker (4)
Aspire.Hosting.Docker.Tests (10)
Aspire.Hosting.Elasticsearch (9)
Aspire.Hosting.Elasticsearch.Tests (14)
Aspire.Hosting.Garnet (23)
GarnetBuilderExtensions.cs (23)
53/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
54public static IResourceBuilder<GarnetResource> AddGarnet(this IDistributedApplicationBuilder builder, [ResourceName] string name,
96/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
97public static IResourceBuilder<GarnetResource> AddGarnet(this IDistributedApplicationBuilder builder, [ResourceName] string name,
98int? port = null, IResourceBuilder<ParameterResource>? password = null)
176/// Use <see cref="WithPersistence(IResourceBuilder{GarnetResource}, TimeSpan?)"/> to adjust Garnet persistence configuration, e.g.:
190/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
191public static IResourceBuilder<GarnetResource> WithDataVolume(this IResourceBuilder<GarnetResource> builder,
211/// Use <see cref="WithPersistence(IResourceBuilder{GarnetResource}, TimeSpan?)"/> to adjust Garnet persistence configuration, e.g.:
225/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
226public static IResourceBuilder<GarnetResource> WithDataBindMount(this IResourceBuilder<GarnetResource> builder,
245/// Use with <see cref="WithDataBindMount(IResourceBuilder{GarnetResource}, string, bool)"/>
246/// or <see cref="WithDataVolume(IResourceBuilder{GarnetResource}, string?, bool)"/> to persist Garnet data across sessions with custom persistence configuration, e.g.:
256/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
258public static IResourceBuilder<GarnetResource> WithPersistence(this IResourceBuilder<GarnetResource> builder,
267/// Use with <see cref="WithDataBindMount(IResourceBuilder{GarnetResource}, string, bool)"/>
268/// or <see cref="WithDataVolume(IResourceBuilder{GarnetResource}, string?, bool)"/> to persist Garnet data across sessions with custom persistence configuration, e.g.:
278/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
279public static IResourceBuilder<GarnetResource> WithPersistence(this IResourceBuilder<GarnetResource> builder,
Aspire.Hosting.Garnet.Tests (27)
Aspire.Hosting.Kafka (16)
Aspire.Hosting.Kafka.Tests (14)
Aspire.Hosting.Keycloak (13)
Aspire.Hosting.Keycloak.Tests (13)
Aspire.Hosting.Kubernetes (7)
Aspire.Hosting.Kubernetes.Tests (7)
Aspire.Hosting.Milvus (20)
MilvusBuilderExtensions.cs (20)
40/// <returns>A reference to the <see cref="IResourceBuilder{MilvusServerResource}"/>.</returns>
41public static IResourceBuilder<MilvusServerResource> AddMilvus(this IDistributedApplicationBuilder builder,
43IResourceBuilder<ParameterResource>? apiKey = null,
94/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
95public static IResourceBuilder<MilvusDatabaseResource> AddDatabase(this IResourceBuilder<MilvusServerResource> builder, [ResourceName] string name, string? databaseName = null)
130/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
131public static IResourceBuilder<T> WithAttu<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<AttuResource>>? configureContainer = null, string? containerName = null) where T : MilvusServerResource
138var resourceBuilder = builder.ApplicationBuilder.AddResource(attuContainer)
156/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
157public static IResourceBuilder<MilvusServerResource> WithDataVolume(this IResourceBuilder<MilvusServerResource> builder, string? name = null, bool isReadOnly = false)
170/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
171public static IResourceBuilder<MilvusServerResource> WithDataBindMount(this IResourceBuilder<MilvusServerResource> builder, string source, bool isReadOnly = false)
184/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
185public static IResourceBuilder<MilvusServerResource> WithConfigurationBindMount(this IResourceBuilder<MilvusServerResource> builder, string configurationFilePath)
Aspire.Hosting.Milvus.Tests (28)
AddMilvusTests.cs (13)
21var pass = appBuilder.AddParameter("apikey", "pass");
51var pass = appBuilder.AddParameter("apikey", "pass");
81var pass = appBuilder.AddParameter("apikey", "pass");
83var milvus = appBuilder.AddMilvus("my-milvus", pass)
97var pass = appBuilder.AddParameter("apikey", "pass");
99var milvus = appBuilder.AddMilvus("my-milvus", pass)
102var projectA = appBuilder.AddProject<ProjectA>("projecta", o => o.ExcludeLaunchProfile = true)
113var container1 = appBuilder.AddContainer("container1", "fake")
129var pass = appBuilder.AddParameter("apikey", "pass");
130var milvus = appBuilder.AddMilvus("milvus", pass);
131var db1 = milvus.AddDatabase("db1");
179var pass = builder.AddParameter("apikey", "pass");
181var milvus = builder.AddMilvus("my-milvus", grpcPort: 5503, apiKey: pass);
Aspire.Hosting.MongoDB (26)
MongoDBBuilderExtensions.cs (26)
32/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
33public static IResourceBuilder<MongoDBServerResource> AddMongoDB(this IDistributedApplicationBuilder builder, [ResourceName] string name, int? port)
46/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
47public static IResourceBuilder<MongoDBServerResource> AddMongoDB(this IDistributedApplicationBuilder builder,
50IResourceBuilder<ParameterResource>? userName = null,
51IResourceBuilder<ParameterResource>? password = null)
99/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
100public static IResourceBuilder<MongoDBDatabaseResource> AddDatabase(this IResourceBuilder<MongoDBServerResource> builder, [ResourceName] string name, string? databaseName = null)
146/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
147public static IResourceBuilder<T> WithMongoExpress<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<MongoExpressContainerResource>>? configureContainer = null, string? containerName = null)
155var resourceBuilder = builder.ApplicationBuilder.AddResource(mongoExpressContainer)
173/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
174public static IResourceBuilder<MongoExpressContainerResource> WithHostPort(this IResourceBuilder<MongoExpressContainerResource> builder, int? port)
190/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
191public static IResourceBuilder<MongoDBServerResource> WithDataVolume(this IResourceBuilder<MongoDBServerResource> builder, string? name = null, bool isReadOnly = false)
204/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
205public static IResourceBuilder<MongoDBServerResource> WithDataBindMount(this IResourceBuilder<MongoDBServerResource> builder, string source, bool isReadOnly = false)
219/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
220public static IResourceBuilder<MongoDBServerResource> WithInitBindMount(this IResourceBuilder<MongoDBServerResource> builder, string source, bool isReadOnly = true)
Aspire.Hosting.MongoDB.Tests (33)
Aspire.Hosting.MySql (22)
MySqlBuilderExtensions.cs (22)
29/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
30public static IResourceBuilder<MySqlServerResource> AddMySql(this IDistributedApplicationBuilder builder, [ResourceName] string name, IResourceBuilder<ParameterResource>? password = null, int? port = null)
71/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
72public static IResourceBuilder<MySqlDatabaseResource> AddDatabase(this IResourceBuilder<MySqlServerResource> builder, [ResourceName] string name, string? databaseName = null)
94/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
95public static IResourceBuilder<T> WithPhpMyAdmin<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<PhpMyAdminContainerResource>>? configureContainer = null, string? containerName = null) where T : MySqlServerResource
107var phpMyAdminContainerBuilder = builder.ApplicationBuilder.AddResource(phpMyAdminContainer)
181public static IResourceBuilder<PhpMyAdminContainerResource> WithHostPort(this IResourceBuilder<PhpMyAdminContainerResource> builder, int? port)
197/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
198public static IResourceBuilder<MySqlServerResource> WithDataVolume(this IResourceBuilder<MySqlServerResource> builder, string? name = null, bool isReadOnly = false)
211/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
212public static IResourceBuilder<MySqlServerResource> WithDataBindMount(this IResourceBuilder<MySqlServerResource> builder, string source, bool isReadOnly = false)
226/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
227public static IResourceBuilder<MySqlServerResource> WithInitBindMount(this IResourceBuilder<MySqlServerResource> builder, string source, bool isReadOnly = true)
Aspire.Hosting.MySql.Tests (42)
MySqlFunctionalTests.cs (16)
40var resource = builder.AddMySql("resource")
43var dependentResource = builder.AddMySql("dependentresource")
78var mysql = builder.AddMySql("mysql").WithEnvironment("MYSQL_DATABASE", mySqlDbName);
79var db = mysql.AddDatabase(mySqlDbName);
132var mysql1 = builder1.AddMySql("mysql").WithEnvironment("MYSQL_DATABASE", mySqlDbName);
135var db1 = mysql1.AddDatabase(mySqlDbName);
208var passwordParameter2 = builder2.AddParameter("pwd", password);
210var mysql2 = builder2.AddMySql("mysql", passwordParameter2);
211var db2 = mysql2.AddDatabase(mySqlDbName);
320var mysql = builder.AddMySql("mysql").WithEnvironment("MYSQL_DATABASE", mySqlDbName);
321var db = mysql.AddDatabase(mySqlDbName);
392var mysql = builder.AddMySql("mysql").WithEnvironment("MYSQL_DATABASE", mySqlDbName);
393var db = mysql.AddDatabase(mySqlDbName);
483var passwordParameter = builder.AddParameter("pwd", "p@ssw0rd1", secret: true);
484var mysql = builder
491var passwordParameter2 = builder.AddParameter("pwd2", "p@ssw0rd2", secret: true);
Aspire.Hosting.Nats (18)
NatsBuilderExtensions.cs (18)
29/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
30public static IResourceBuilder<NatsServerResource> AddNats(this IDistributedApplicationBuilder builder, [ResourceName] string name, int? port)
46/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
47public static IResourceBuilder<NatsServerResource> AddNats(this IDistributedApplicationBuilder builder, [ResourceName] string name, int? port = null,
48IResourceBuilder<ParameterResource>? userName = null,
49IResourceBuilder<ParameterResource>? password = null)
111/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
113public static IResourceBuilder<NatsServerResource> WithJetStream(this IResourceBuilder<NatsServerResource> builder, string? srcMountPath = null)
132/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
133public static IResourceBuilder<NatsServerResource> WithJetStream(this IResourceBuilder<NatsServerResource> builder)
146/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
147public static IResourceBuilder<NatsServerResource> WithDataVolume(this IResourceBuilder<NatsServerResource> builder, string? name = null, bool isReadOnly = false)
162/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
163public static IResourceBuilder<NatsServerResource> WithDataBindMount(this IResourceBuilder<NatsServerResource> builder, string source, bool isReadOnly = false)
Aspire.Hosting.Nats.Tests (34)
Aspire.Hosting.NodeJs (6)
Aspire.Hosting.NodeJs.Tests (4)
Aspire.Hosting.Oracle (18)
Aspire.Hosting.Oracle.Tests (37)
Aspire.Hosting.Orleans (20)
Aspire.Hosting.PostgreSQL (53)
PostgresBuilderExtensions.cs (53)
31/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
35/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
41public static IResourceBuilder<PostgresServerResource> AddPostgres(this IDistributedApplicationBuilder builder,
43IResourceBuilder<ParameterResource>? userName = null,
44IResourceBuilder<ParameterResource>? password = null,
124/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
128/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
132/// Note that by default calling <see cref="AddDatabase(IResourceBuilder{PostgresServerResource}, string, string?)"/>
134/// will create the database. As a result if <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
138public static IResourceBuilder<PostgresDatabaseResource> AddDatabase(this IResourceBuilder<PostgresServerResource> builder, [ResourceName] string name, string? databaseName = null)
179/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
180public static IResourceBuilder<T> WithPgAdmin<T>(this IResourceBuilder<T> builder, Action<IResourceBuilder<PgAdminContainerResource>>? configureContainer = null, string? containerName = null)
187var builderForExistingResource = builder.ApplicationBuilder.CreateResourceBuilder(existingPgAdminResource);
196var pgAdminContainerBuilder = builder.ApplicationBuilder.AddResource(pgAdminContainer)
234public static IResourceBuilder<PgAdminContainerResource> WithHostPort(this IResourceBuilder<PgAdminContainerResource> builder, int? port)
250public static IResourceBuilder<PgWebContainerResource> WithHostPort(this IResourceBuilder<PgWebContainerResource> builder, int? port)
284/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
285public static IResourceBuilder<PostgresServerResource> WithPgWeb(this IResourceBuilder<PostgresServerResource> builder, Action<IResourceBuilder<PgWebContainerResource>>? configureContainer = null, string? containerName = null)
291var builderForExistingResource = builder.ApplicationBuilder.CreateResourceBuilder(existingPgWebResource);
299var pgwebContainerBuilder = builder.ApplicationBuilder.AddResource(pgwebContainer)
367/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
368public static IResourceBuilder<PostgresServerResource> WithDataVolume(this IResourceBuilder<PostgresServerResource> builder, string? name = null, bool isReadOnly = false)
382/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
383public static IResourceBuilder<PostgresServerResource> WithDataBindMount(this IResourceBuilder<PostgresServerResource> builder, string source, bool isReadOnly = false)
397/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
398public static IResourceBuilder<PostgresServerResource> WithInitBindMount(this IResourceBuilder<PostgresServerResource> builder, string source, bool isReadOnly = true)
411/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
417public static IResourceBuilder<PostgresDatabaseResource> WithCreationScript(this IResourceBuilder<PostgresDatabaseResource> builder, string script)
432/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
433public static IResourceBuilder<PostgresServerResource> WithPassword(this IResourceBuilder<PostgresServerResource> builder, IResourceBuilder<ParameterResource> password)
447/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
448public static IResourceBuilder<PostgresServerResource> WithUserName(this IResourceBuilder<PostgresServerResource> builder, IResourceBuilder<ParameterResource> userName)
462/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
463public static IResourceBuilder<PostgresServerResource> WithHostPort(this IResourceBuilder<PostgresServerResource> builder, int? port)
Aspire.Hosting.PostgreSQL.Tests (75)
AddPostgresTests.cs (29)
21var redis = builder.AddPostgres("postgres");
30var pg = appBuilder.AddPostgres("pg");
40var pg = appBuilder.AddPostgres("pg");
102var pass = appBuilder.AddParameter("pass", "pass");
155var postgres = appBuilder.AddPostgres("postgres")
192var pass = appBuilder.AddParameter("pass", "pass");
246var pgServer = builder.AddPostgres("pg");
247var db = pgServer.AddDatabase("db");
289var userNameParameter = builder.AddParameter("user");
290var passwordParameter = builder.AddParameter("pass");
292var pgServer = builder.AddPostgres("pg", userNameParameter, passwordParameter);
461var username = builder.AddParameter("pg-user", "myuser");
462var pg1 = builder.AddPostgres("mypostgres1").WithPgAdmin(pga => pga.WithHostPort(8081));
463var pg2 = builder.AddPostgres("mypostgres2", username).WithPgAdmin(pga => pga.WithHostPort(8081));
530var pg1 = builder.AddPostgres("mypostgres1").WithPgWeb(pga => pga.WithHostPort(8081));
531var pg2 = builder.AddPostgres("mypostgres2").WithPgWeb(pga => pga.WithHostPort(8081));
537var db1 = pg1.AddDatabase("db1");
538var db2 = pg2.AddDatabase("db2");
593var db = builder.AddPostgres("postgres1");
607var db = builder.AddPostgres("postgres2");
616var postgres1 = builder.AddPostgres("postgres1");
618var db1 = postgres1.AddDatabase("db1", "customers1");
619var db2 = postgres1.AddDatabase("db2", "customers2");
633var db1 = builder.AddPostgres("postgres1")
636var db2 = builder.AddPostgres("postgres2")
681var pass = builder.AddParameter("pass", password);
682var postgres = builder.AddPostgres("postgres")
695var pass = builder.AddParameter("user", user);
696var postgres = builder.AddPostgres("postgres")
PostgresFunctionalTests.cs (32)
42var postgres = builder.AddPostgres("postgres")
45var dependentResource = builder.AddPostgres("dependentresource")
79IResourceBuilder<PgAdminContainerResource>? adminBuilder = null;
80var redis = builder.AddPostgres("postgres").WithPgAdmin(c => adminBuilder = c);
109var postgres = builder.AddPostgres("pg");
110var db = postgres.AddDatabase(postgresDbName);
150IResourceBuilder<PgWebContainerResource>? pgWebBuilder = null;
152var pg = builder.AddPostgres("pg1");
153var db = pg.AddDatabase(dbName);
208var usernameParameter = builder1.AddParameter("user", username);
209var passwordParameter = builder1.AddParameter("pwd", password, secret: true);
210var postgres1 = builder1.AddPostgres("pg", usernameParameter, passwordParameter);
212var db1 = postgres1.AddDatabase(postgresDbName);
280var postgres2 = builder2.AddPostgres("pg", usernameParameter, passwordParameter);
281var db2 = postgres2.AddDatabase(postgresDbName);
382var postgres = builder.AddPostgres("pg").WithEnvironment("POSTGRES_DB", postgresDbName);
384var db = postgres.AddDatabase(postgresDbName);
473var passwordParameter = builder.AddParameter("pwd", "p@ssword1", secret: true);
515var postgres = builder.AddPostgres("pg1");
517var newDb = postgres.AddDatabase(databaseName)
560var postgres = builder.AddPostgres("pg1");
562var newDb = postgres.AddDatabase(resourceName, databaseName);
615var usernameParameter = builder.AddParameter("user", username);
616var passwordParameter = builder.AddParameter("pwd", password, secret: true);
618var postgres = builder.AddPostgres("pg1", usernameParameter, passwordParameter);
631var newDb = postgres.AddDatabase(resourceName, databaseName);
682var postgres = builder.AddPostgres("pg1");
684var db1 = postgres.AddDatabase("db1");
685var db2 = postgres.AddDatabase("db2");
686var db3 = postgres.AddDatabase("db3");
696foreach (var db in dbs)
706foreach (var db in dbs)
Aspire.Hosting.Python (10)
Aspire.Hosting.Python.Tests (4)
Aspire.Hosting.Qdrant (14)
Aspire.Hosting.Qdrant.Tests (26)
AddQdrantTests.cs (13)
23var qd = appBuilder.AddQdrant("qd");
33var qd = appBuilder.AddQdrant("qd");
113var pass = appBuilder.AddParameter("pass", "pass");
154var pass = appBuilder.AddParameter("pass", "pass");
156var qdrant = appBuilder.AddQdrant("my-qdrant", pass)
170var pass = appBuilder.AddParameter("pass", "pass");
172var qdrant = appBuilder.AddQdrant("my-qdrant", pass)
176var projectA = appBuilder.AddProject<ProjectA>("projecta", o => o.ExcludeLaunchProfile = true)
188var container1 = appBuilder.AddContainer("container1", "fake")
205var qdrant = appBuilder.AddQdrant("qdrant");
242var apiKeyParameter = appBuilder.AddParameter("QdrantApiKey");
243var qdrant = appBuilder.AddQdrant("qdrant", apiKeyParameter);
280var qdrant = builder.AddQdrant("my-qdrant", grpcPort: 5503, httpPort: 5504);
Aspire.Hosting.RabbitMQ (20)
Aspire.Hosting.RabbitMQ.Tests (23)
Aspire.Hosting.Redis (51)
RedisBuilderExtensions.cs (51)
24/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
28/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
34public static IResourceBuilder<RedisResource> AddRedis(this IDistributedApplicationBuilder builder, [ResourceName] string name, int? port)
46/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
50/// using the <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
56public static IResourceBuilder<RedisResource> AddRedis(
60IResourceBuilder<ParameterResource>? password = null)
136/// <param name="builder">The <see cref="IResourceBuilder{T}"/> for the <see cref="RedisResource"/>.</param>
140public static IResourceBuilder<RedisResource> WithRedisCommander(this IResourceBuilder<RedisResource> builder, Action<IResourceBuilder<RedisCommanderResource>>? configureContainer = null, string? containerName = null)
146var builderForExistingResource = builder.ApplicationBuilder.CreateResourceBuilder(existingRedisCommanderResource);
155var resourceBuilder = builder.ApplicationBuilder.AddResource(resource)
207/// <param name="builder">The <see cref="IResourceBuilder{T}"/> for the <see cref="RedisResource"/>.</param>
211public static IResourceBuilder<RedisResource> WithRedisInsight(this IResourceBuilder<RedisResource> builder, Action<IResourceBuilder<RedisInsightResource>>? configureContainer = null, string? containerName = null)
217var builderForExistingResource = builder.ApplicationBuilder.CreateResourceBuilder(existingRedisCommanderResource);
226var resourceBuilder = builder.ApplicationBuilder.AddResource(resource)
271public static IResourceBuilder<RedisCommanderResource> WithHostPort(this IResourceBuilder<RedisCommanderResource> builder, int? port)
287public static IResourceBuilder<RedisInsightResource> WithHostPort(this IResourceBuilder<RedisInsightResource> builder, int? port)
301/// Use <see cref="WithPersistence(IResourceBuilder{RedisResource}, TimeSpan?, long)"/> to adjust Redis persistence configuration, e.g.:
314/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
315public static IResourceBuilder<RedisResource> WithDataVolume(this IResourceBuilder<RedisResource> builder, string? name = null, bool isReadOnly = false)
331/// Use <see cref="WithPersistence(IResourceBuilder{RedisResource}, TimeSpan?, long)"/> to adjust Redis persistence configuration, e.g.:
344/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
345public static IResourceBuilder<RedisResource> WithDataBindMount(this IResourceBuilder<RedisResource> builder, string source, bool isReadOnly = false)
362/// Use with <see cref="WithDataBindMount(IResourceBuilder{RedisResource}, string, bool)"/>
363/// or <see cref="WithDataVolume(IResourceBuilder{RedisResource}, string?, bool)"/> to persist Redis data across sessions with custom persistence configuration, e.g.:
373/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
374public static IResourceBuilder<RedisResource> WithPersistence(this IResourceBuilder<RedisResource> builder, TimeSpan? interval = null, long keysChangedThreshold = 1)
393/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
395public static IResourceBuilder<RedisInsightResource> WithDataVolume(this IResourceBuilder<RedisInsightResource> builder, string? name = null)
407/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
408public static IResourceBuilder<RedisInsightResource> WithDataBindMount(this IResourceBuilder<RedisInsightResource> builder, string source)
421/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
422public static IResourceBuilder<RedisResource> WithPassword(this IResourceBuilder<RedisResource> builder, IResourceBuilder<ParameterResource> password)
436/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
437public static IResourceBuilder<RedisResource> WithHostPort(this IResourceBuilder<RedisResource> builder, int port)
Aspire.Hosting.Redis.Tests (60)
Aspire.Hosting.Seq (7)
Aspire.Hosting.Seq.Tests (9)
Aspire.Hosting.SqlServer (22)
SqlServerBuilderExtensions.cs (22)
35/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
36public static IResourceBuilder<SqlServerServerResource> AddSqlServer(this IDistributedApplicationBuilder builder, [ResourceName] string name, IResourceBuilder<ParameterResource>? password = null, int? port = null)
100/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
101public static IResourceBuilder<SqlServerDatabaseResource> AddDatabase(this IResourceBuilder<SqlServerServerResource> builder, [ResourceName] string name, string? databaseName = null)
139/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
140public static IResourceBuilder<SqlServerServerResource> WithDataVolume(this IResourceBuilder<SqlServerServerResource> builder, string? name = null, bool isReadOnly = false)
153/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
158public static IResourceBuilder<SqlServerServerResource> WithDataBindMount(this IResourceBuilder<SqlServerServerResource> builder, string source, bool isReadOnly = false)
189/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
193public static IResourceBuilder<SqlServerDatabaseResource> WithCreationScript(this IResourceBuilder<SqlServerDatabaseResource> builder, string script)
208/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
209public static IResourceBuilder<SqlServerServerResource> WithPassword(this IResourceBuilder<SqlServerServerResource> builder, IResourceBuilder<ParameterResource> password)
223/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
224public static IResourceBuilder<SqlServerServerResource> WithHostPort(this IResourceBuilder<SqlServerServerResource> builder, int port)
Aspire.Hosting.SqlServer.Tests (43)
Aspire.Hosting.Testing (6)
Aspire.Hosting.Testing.Tests (3)
Aspire.Hosting.Tests (245)
Dcp\DcpExecutorTests.cs (12)
132var resourceBuilder = builder.AddProject<Projects.ServiceA>("ServiceA");
231var exe = builder.AddExecutable("CoolProgram", "cool", Environment.CurrentDirectory, "--alpha", "--bravo")
263var exe = builder.AddExecutable("CoolProgram", "cool", Environment.CurrentDirectory, "--alpha", "--bravo")
295var exe = builder.AddExecutable("CoolProgram", "cool", Environment.CurrentDirectory, "--alpha", "--bravo")
328var exe = builder.AddExecutable("CoolProgram", "cool", Environment.CurrentDirectory, "--alpha", "--bravo")
488(Action<IResourceBuilder<ExecutableResource>> AddEndpoint, string ErrorMessageFragment)[] testcases = [
517var exe = builder.AddExecutable("CoolProgram", "cool", Environment.CurrentDirectory, "--alpha", "--bravo");
932(Action<IResourceBuilder<ContainerResource>> AddEndpoint, string ErrorMessageFragment)[] testcases = [
956var ctr = builder.AddContainer("database", "image");
1153var container = builder.AddContainer("database", "image");
1154var exe = builder.AddExecutable("node", "node.exe", ".");
1155var project = builder.AddProject<TestProject>("project");
Orchestrator\ApplicationOrchestratorTests.cs (14)
24var parentResource = builder.AddContainer("database", "image");
25var childResource = builder.AddResource(new CustomChildResource("child", parentResource.Resource));
70var parent = builder.AddContainer("parent", "image");
71var child = builder.AddContainer("child", "image").WithParentRelationship(parent);
72var child2 = builder.AddContainer("child2", "image").WithParentRelationship(parent);
74var nestedChild = builder.AddContainer("nested-child", "image").WithParentRelationship(child);
135var firstParent = builder.AddContainer("firstParent", "image");
136var secondParent = builder.AddContainer("secondParent", "image");
138var child = builder.AddContainer("child", "image");
193var projectA = builder.AddProject<ProjectA>("projecta");
194var projectB = builder.AddProject<ProjectB>("projectb").WithParentRelationship(projectA);
240var container1 = builder.AddContainer("container1", "image");
241var container2 = builder.AddContainer("container2", "image2");
242var container3 = builder.AddContainer("container3", "image3");
ResourceExtensionsTests.cs (13)
150var container = builder.AddContainer("grafana", "grafana/grafana", "latest").WithImageSHA256("1adbcc2df3866ff5ec1d836e9d2220c904c7f98901b918d3cc5e1118ab1af991");
160var container = builder.AddContainer("grafana", "grafana/grafana", "10.3.1");
170var container = builder.AddContainer("elasticsearch", "library/elasticsearch", "8.14.0")
206var passwordParameter = builder.AddParameter("ElasticPassword");
208var container = builder.AddContainer("elasticsearch", "library/elasticsearch", "8.14.0")
239var passwordParameter = builder.AddParameter("ElasticPassword");
241var container = builder.AddContainer("elasticsearch", "library/elasticsearch", "8.14.0")
270var surrogate = builder.AddResource(new ConnectionStringParameterResource("ResourceWithConnectionStringSurrogate", _ => "ConnectionString", null));
271var secretParameter = builder.AddResource(new ParameterResource("SecretParameter", _ => "SecretParameter", true));
272var nonSecretParameter = builder.AddResource(new ParameterResource("NonSecretParameter", _ => "NonSecretParameter"));
300var compute1 = builder.AddResource(new ComputeEnvironmentResource("compute1"));
301var compute2 = builder.AddResource(new ComputeEnvironmentResource("compute2"));
303void RunTest<T>(IResourceBuilder<T> resourceBuilder) where T : IComputeResource
WaitForTests.cs (17)
21var throwingResource = builder.AddContainer("throwingresource", "doesnotmatter")
23var dependingContainerResource = builder.AddContainer("dependingcontainerresource", "doesnotmatter")
25var dependingExecutableResource = builder.AddExecutable("dependingexecutableresource", "doesnotmatter", "alsodoesntmatter")
94var cs = builder.AddConnectionString("cs");
95var param = builder.AddParameter("param", "value");
127var cs = builder.AddConnectionString("cs", ReferenceExpression.Create($"{dependency};Timeout=100"));
129var nginx = builder.AddContainer("nginx", "mcr.microsoft.com/cbl-mariner/base/nginx", "1.22")
234var failToStart = builder.AddExecutable("failToStart", "does-not-exist", ".");
235var dependency = builder.AddContainer("redis", "redis");
258var failToStart = builder.AddExecutable("failToStart", "does-not-exist", ".");
259var dependency = builder.AddContainer("redis", "redis");
289var failToStart = builder.AddExecutable("failToStart", "does-not-exist", ".");
290var dependency = builder.AddContainer("redis", "redis");
435var nginx = builder.AddContainer("nginx", "mcr.microsoft.com/cbl-mariner/base/nginx", "1.22")
591var nginx = builder.AddContainer("nginx", "mcr.microsoft.com/cbl-mariner/base/nginx", "1.22")
695var nginx = builder.AddContainer("nginx", "mcr.microsoft.com/cbl-mariner/base/nginx", "1.22")
744var nginx = builder.AddContainer("nginx", "mcr.microsoft.com/cbl-mariner/base/nginx", "1.22")
WithEndpointTests.cs (20)
22var projectA = builder.AddProject<ProjectA>("projecta")
39var projectA = builder.AddProject<ProjectA>("projecta")
74var projectA = builder.AddProject<ProjectA>("projecta")
111var projectA = builder.AddProject<ProjectA>("projecta")
129var projectA = builder.AddProject<ProjectA>("projecta")
146var projectA = builder.AddProject<ProjectA>("projecta").WithEndpoint("mybinding", endpoint =>
230var container = builder.AddContainer("app", "image")
248var container = builder.AddContainer("app", "image")
269var container = builder.AddContainer("app", "image")
297var container = builder.AddContainer("app", "image")
324var container = builder.AddContainer("app", "image")
351var container = builder.AddContainer("app", "image")
378var container = builder.AddContainer("app", "image")
405var container = builder.AddContainer("app", "image")
432var container = builder.AddContainer("app", "image")
459var project = builder.AddProject<TestProject>("proj")
521var project = builder.AddProject<TestProject>("proj")
557var container0 = builder.AddContainer("app0", "image")
560var container1 = builder.AddContainer("app1", "image")
605var projectA = builder.AddProject<ProjectA>("projecta")
WithEnvironmentTests.cs (23)
19var container = builder.AddContainer("container", "image")
45var projectA = builder.AddProject<ProjectA>("project")
52var projectB = builder.AddProject<ProjectB>("projectB")
73var project = builder.AddProject<ProjectA>("projectA")
89var project = builder.AddProject<ProjectA>("projectA")
103var projectA = builder.AddProject<ProjectA>("projectA").WithEnvironment("myName", () => environmentValue);
120var parameter = builder.AddParameter("parameter");
122var projectA = builder.AddProject<ProjectA>("projectA")
143var parameter = builder.AddParameter("parameter");
145var projectA = builder.AddProject<ProjectA>("projectA")
159var parameter = builder.AddParameter("parameter");
161var projectA = builder.AddProject<ProjectA>("projectA")
179var projectA = builder.AddProject<ProjectA>("projectA")
201var projectA = builder.AddProject<ProjectA>("projectA")
224var test = builder.AddResource(new TestResource("test", "connectionString"));
226var container = builder.AddContainer("container1", "image")
235var containerB = builder.AddContainer("container2", "imageB")
275var container = builder.AddContainer("container1", "image")
284var containerB = builder.AddContainer("container2", "imageB")
301var container = builder.AddContainer("container1", "image")
310var containerB = builder.AddContainer("container2", "imageB")
328var sourceBuilder = builder.AddResource(new TestResource("sourceService", sourceCon));
329var targetBuilder = builder.AddContainer("targetContainer", "targetImage");
Aspire.Hosting.Valkey (18)
ValkeyBuilderExtensions.cs (18)
55/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
56public static IResourceBuilder<ValkeyResource> AddValkey(
105/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
106public static IResourceBuilder<ValkeyResource> AddValkey(
110IResourceBuilder<ParameterResource>? password = null)
192/// Use <see cref="WithPersistence(IResourceBuilder{ValkeyResource}, TimeSpan?, long)"/> to adjust Valkey persistence configuration, e.g.:
200/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
201public static IResourceBuilder<ValkeyResource> WithDataVolume(
202this IResourceBuilder<ValkeyResource> builder,
229/// Use <see cref="WithPersistence(IResourceBuilder{ValkeyResource}, TimeSpan?, long)"/> to adjust Valkey persistence configuration, e.g.:
237/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
238public static IResourceBuilder<ValkeyResource> WithDataBindMount(
239this IResourceBuilder<ValkeyResource> builder,
263/// Use with <see cref="WithDataBindMount(IResourceBuilder{ValkeyResource}, string, bool)"/>
264/// or <see cref="WithDataVolume(IResourceBuilder{ValkeyResource}, string?, bool)"/> to persist Valkey data across sessions with custom persistence configuration, e.g.:
272/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
273public static IResourceBuilder<ValkeyResource> WithPersistence(
274this IResourceBuilder<ValkeyResource> builder,
Aspire.Hosting.Valkey.Tests (25)
Aspire.Playground.Tests (1)
AzureContainerApps.AppHost (7)
AzureFunctionsEndToEnd.AppHost (5)
AzureSearch.AppHost (1)
AzureStorageEndToEnd.AppHost (3)
BicepSample.AppHost (20)
CdkSample.AppHost (20)
CosmosEndToEnd.AppHost (3)
CustomResources.AppHost (2)
DatabaseMigration.AppHost (1)
Elasticsearch.AppHost (1)
EventHubs.AppHost (2)
KafkaBasic.AppHost (1)
Keycloak.AppHost (2)
MilvusPlayground.AppHost (1)
Mongo.AppHost (1)
MySqlDb.AppHost (1)
Nats.AppHost (1)
OpenAIEndToEnd.AppHost (1)
OracleEndToEnd.AppHost (2)
Orleans.AppHost (3)
ParameterEndToEnd.AppHost (3)
PostgresEndToEnd.AppHost (1)
ProxylessEndToEnd.AppHost (1)
Publishers.AppHost (10)
Qdrant.AppHost (1)
Redis.AppHost (3)
Seq.AppHost (1)
ServiceBus.AppHost (3)
SignalR.AppHost (2)
SqlServerEndToEnd.AppHost (5)
Stress.AppHost (9)
TestingAppHost1.AppHost (2)
TestProject.AppHost (8)
TestShop.AppHost (8)
WaitForSandbox.AppHost (3)
WebPubSub.AppHost (4)
WithDockerfile.AppHost (2)