# Role

- Kind: `class`
- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Aspire.Hosting.Kubernetes.Resources`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/RoleV1.cs)
- Inherits: [BaseKubernetesResource](/reference/api/csharp/aspire.hosting.kubernetes/basekubernetesresource.md)

Defines a Kubernetes Role resource within the "rbac.authorization.k8s.io/v1" API group.

## Definition

```csharp
namespace Aspire.Hosting.Kubernetes.Resources;

public sealed class Role
    : Aspire.Hosting.Kubernetes.Resources.BaseKubernetesResource
{
    // ...
}
```

## Remarks

A Role is used to grant access to resources within a specific namespace in Kubernetes. It is composed of a collection of policy rules that determine the permitted actions (e.g., get, list, create) on specified resources within the namespace. This class extends the BaseKubernetesResource for consistent handling of Kubernetes resources.

## Constructors

- [Role](/reference/api/csharp/aspire.hosting.kubernetes/role/constructors.md#constructor) -- Defines a Kubernetes Role resource within the "rbac.authorization.k8s.io/v1" API group.

## Properties

- [Rules](/reference/api/csharp/aspire.hosting.kubernetes/role/properties.md#rules) : [List<PolicyRuleV1>](/reference/api/csharp/aspire.hosting.kubernetes/policyrulev1.md) `get` -- Represents the list of policy rules associated with a Kubernetes Role resource.

## See Also

- [PolicyRuleV1](/reference/api/csharp/aspire.hosting.kubernetes/policyrulev1.md)
- [BaseKubernetesResource](/reference/api/csharp/aspire.hosting.kubernetes/basekubernetesresource.md)
