# ResourceWithEndpoints

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `interface`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Represents a resource that has endpoints associated with it.

## Definition

```go
type ResourceWithEndpoints interface{}
```

## Methods

A marker interface declares no methods of its own in Go. Its functions are declared on the concrete types they apply to.

- [AsHttp2Service](/reference/api/go/aspire.hosting/resourcewithendpoints/ashttp2service.md) -- `method` -- Configures a resource to mark all endpoints' transport as HTTP/2. This is useful for HTTP/2 services that need prior knowledge.
  ```go
  AsHttp2Service() ResourceWithEndpoints
  ```
- [GetEndpoint](/reference/api/go/aspire.hosting/resourcewithendpoints/getendpoint.md) -- `method` -- Gets an endpoint reference
  ```go
  GetEndpoint(name string) EndpointReference
  ```
- [OnResourceEndpointsAllocated](/reference/api/go/aspire.hosting/resourcewithendpoints/onresourceendpointsallocated.md) -- `method` -- Subscribes to the ResourceEndpointsAllocated event.
  ```go
  OnResourceEndpointsAllocated(callback func(arg ResourceEndpointsAllocatedEvent)) ResourceWithEndpoints
  ```
- [WithEndpoint](/reference/api/go/aspire.hosting/resourcewithendpoints/withendpoint.md) -- `method` -- Adds a network endpoint
  ```go
  WithEndpoint(options ...*WithEndpointOptions) ResourceWithEndpoints
  ```
- [WithEndpointCallback](/reference/api/go/aspire.hosting/resourcewithendpoints/withendpointcallback.md) -- `method` -- Updates a named endpoint via callback
  ```go
  WithEndpointCallback(endpointName string, callback func(obj EndpointUpdateContext), options ...*WithEndpointCallbackOptions) ResourceWithEndpoints
  ```
- [WithEndpointProxySupport](/reference/api/go/aspire.hosting/resourcewithendpoints/withendpointproxysupport.md) -- `method` -- Set whether a resource can use proxied endpoints or whether they should be disabled for all endpoints belonging to the resource. If set to `false`, endpoints belonging to the resource will ignore the configured proxy settings and run proxy-less.
  ```go
  WithEndpointProxySupport(proxyEnabled bool) ResourceWithEndpoints
  ```
- [WithExternalHttpEndpoints](/reference/api/go/aspire.hosting/resourcewithendpoints/withexternalhttpendpoints.md) -- `method` -- Marks existing http or https endpoints on a resource as external.
  ```go
  WithExternalHttpEndpoints() ResourceWithEndpoints
  ```
- [WithHttpCommand](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpcommand.md) -- `method` -- Adds an HTTP resource command
  ```go
  WithHttpCommand(path string, displayName string, options ...*HttpCommandExportOptions) ResourceWithEndpoints
  ```
- [WithHttpEndpoint](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpendpoint.md) -- `method` -- Adds an HTTP endpoint
  ```go
  WithHttpEndpoint(options ...*WithHttpEndpointOptions) ResourceWithEndpoints
  ```
- [WithHttpEndpointCallback](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpendpointcallback.md) -- `method` -- Updates an HTTP endpoint via callback
  ```go
  WithHttpEndpointCallback(callback func(obj EndpointUpdateContext), options ...*WithHttpEndpointCallbackOptions) ResourceWithEndpoints
  ```
- [WithHttpHealthCheck](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttphealthcheck.md) -- `method` -- Adds a health check to the resource which is mapped to a specific endpoint.
  ```go
  WithHttpHealthCheck(options ...*WithHttpHealthCheckOptions) ResourceWithEndpoints
  ```
- [WithHttpProbe](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpprobe.md) -- `method` -- Adds an HTTP health probe to the resource
  ```go
  WithHttpProbe(probeType ProbeType, options ...*WithHttpProbeOptions) ResourceWithEndpoints
  ```
- [WithHttpsEndpoint](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpsendpoint.md) -- `method` -- Adds an HTTPS endpoint
  ```go
  WithHttpsEndpoint(options ...*WithHttpsEndpointOptions) ResourceWithEndpoints
  ```
- [WithHttpsEndpointCallback](/reference/api/go/aspire.hosting/resourcewithendpoints/withhttpsendpointcallback.md) -- `method` -- Updates an HTTPS endpoint via callback
  ```go
  WithHttpsEndpointCallback(callback func(obj EndpointUpdateContext), options ...*WithHttpsEndpointCallbackOptions) ResourceWithEndpoints
  ```
- [WithMcpServer](/reference/api/go/aspire.hosting/resourcewithendpoints/withmcpserver.md) -- `method` -- Marks the resource as hosting a Model Context Protocol (MCP) server on the specified endpoint.
  ```go
  WithMcpServer(options ...*WithMcpServerOptions) ResourceWithEndpoints
  ```

## Applies to

- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
