# KubernetesGatewayResource

- Module: [Aspire.Hosting.Kubernetes](/reference/api/typescript/aspire.hosting.kubernetes.md)
- Version: `13.3.0-preview.1.26254.5`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface KubernetesGatewayResource
  extends IResource,
    IResourceWithParent,
    KubernetesEnvironmentResource]] {
  withGatewayAnnotation(
      key: string,
      value: string): KubernetesGatewayResource;
  withGatewayAnnotationParam(
      key: string,
      value: ParameterResource): KubernetesGatewayResource;
  withGatewayClass(className: string): KubernetesGatewayResource;
  withGatewayClassParam(className: ParameterResource): KubernetesGatewayResource;
  withGatewayHostnameParam(hostname: ParameterResource): KubernetesGatewayResource;
  withGatewayHostRoute(
      host: string,
      path: string,
      endpoint: EndpointReference,
      pathType?: IngressPathType): KubernetesGatewayResource;
  withGatewayPathRoute(
      path: string,
      endpoint: EndpointReference,
      pathType?: IngressPathType): KubernetesGatewayResource;
  withGatewayTlsAuto(): KubernetesGatewayResource;
  withGatewayTlsParam(secretName: ParameterResource): KubernetesGatewayResource;
  withHostname(hostname: string): KubernetesGatewayResource;
  withTls(secretName: string): KubernetesGatewayResource;
}
```

## Methods

- [withGatewayAnnotation](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayannotation.md) -- `method` -- Adds a Kubernetes metadata annotation to a Gateway
    ```typescript
  withGatewayAnnotation(key: string, value: string): KubernetesGatewayResource
  ```
- [withGatewayAnnotationParam](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayannotationparam.md) -- `method` -- Adds a parameterized Kubernetes metadata annotation to a Gateway
    ```typescript
  withGatewayAnnotationParam(key: string, value: ParameterResource): KubernetesGatewayResource
  ```
- [withGatewayClass](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayclass.md) -- `method` -- Sets the GatewayClass for a Kubernetes Gateway
    ```typescript
  withGatewayClass(className: string): KubernetesGatewayResource
  ```
- [withGatewayClassParam](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayclassparam.md) -- `method` -- Sets a parameterized GatewayClass for a Kubernetes Gateway
    ```typescript
  withGatewayClassParam(className: ParameterResource): KubernetesGatewayResource
  ```
- [withGatewayHostnameParam](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayhostnameparam.md) -- `method` -- Adds a parameterized hostname to a Kubernetes Gateway
    ```typescript
  withGatewayHostnameParam(hostname: ParameterResource): KubernetesGatewayResource
  ```
- [withGatewayHostRoute](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewayhostroute.md) -- `method` -- Adds a host-and-path route to a Kubernetes Gateway
    ```typescript
  withGatewayHostRoute(host: string, path: string, endpoint: EndpointReference, pathType?: IngressPathType): KubernetesGatewayResource
  ```
- [withGatewayPathRoute](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewaypathroute.md) -- `method` -- Adds a path-based route to a Kubernetes Gateway
    ```typescript
  withGatewayPathRoute(path: string, endpoint: EndpointReference, pathType?: IngressPathType): KubernetesGatewayResource
  ```
- [withGatewayTlsAuto](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewaytlsauto.md) -- `method` -- Configures TLS on a Kubernetes Gateway with an auto-generated secret
    ```typescript
  withGatewayTlsAuto(): KubernetesGatewayResource
  ```
- [withGatewayTlsParam](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withgatewaytlsparam.md) -- `method` -- Configures TLS on a Kubernetes Gateway with a parameterized secret
    ```typescript
  withGatewayTlsParam(secretName: ParameterResource): KubernetesGatewayResource
  ```
- [withHostname](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withhostname.md) -- `method` -- Adds a hostname to a Kubernetes Gateway
    ```typescript
  withHostname(hostname: string): KubernetesGatewayResource
  ```
- [withTls](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesgatewayresource/withtls.md) -- `method` -- Configures TLS on a Kubernetes Gateway listener
    ```typescript
  withTls(secretName: string): KubernetesGatewayResource
  ```
