Table of Contents

Class AccountRole

Namespace
Cloudflare.NET.Roles.Models
Assembly
Cloudflare.NET.dll

Represents a role that can be assigned to account members.

Roles are predefined by Cloudflare and define sets of permissions for various features. Use ListAccountRolesAsync(string, ListAccountRolesFilters?, CancellationToken) to discover available roles.

public record AccountRole : IEquatable<AccountRole>
Inheritance
AccountRole
Implements
Inherited Members

Examples

// Get available roles and check permissions
var roles = await client.Roles.ListAccountRolesAsync(accountId);

foreach (var role in roles.Items)
{
  Console.WriteLine($"{role.Name}: {role.Description}");
  if (role.Permissions.Dns?.Write == true)
    Console.WriteLine("  - Can modify DNS");
}

Constructors

AccountRole(string, string, string, RolePermissions)

Represents a role that can be assigned to account members.

Roles are predefined by Cloudflare and define sets of permissions for various features. Use ListAccountRolesAsync(string, ListAccountRolesFilters?, CancellationToken) to discover available roles.

public AccountRole(string Id, string Name, string Description, RolePermissions Permissions)

Parameters

Id string

Role identifier (used when assigning roles to members).

Name string

Human-readable role name.

Description string

Description of the role's purpose.

Permissions RolePermissions

Feature permissions granted by this role.

Examples

// Get available roles and check permissions
var roles = await client.Roles.ListAccountRolesAsync(accountId);

foreach (var role in roles.Items)
{
  Console.WriteLine($"{role.Name}: {role.Description}");
  if (role.Permissions.Dns?.Write == true)
    Console.WriteLine("  - Can modify DNS");
}

Properties

Description

Description of the role's purpose.

[JsonPropertyName("description")]
public string Description { get; init; }

Property Value

string

Id

Role identifier (used when assigning roles to members).

[JsonPropertyName("id")]
public string Id { get; init; }

Property Value

string

Name

Human-readable role name.

[JsonPropertyName("name")]
public string Name { get; init; }

Property Value

string

Permissions

Feature permissions granted by this role.

[JsonPropertyName("permissions")]
public RolePermissions Permissions { get; init; }

Property Value

RolePermissions