using System.Runtime.Serialization; using Newtonsoft.Json.Converters; namespace AMWD.Net.Api.Cloudflare { /// /// A Cloudflare member. /// Source /// public class Member { /// /// Membership identifier tag. /// [JsonProperty("id")] public string? Id { get; set; } /// /// Access policy for the membership. /// [JsonProperty("policies")] public IReadOnlyCollection? Policies { get; set; } /// /// Roles assigned to this Member. /// [JsonProperty("roles")] public IReadOnlyCollection? Roles { get; set; } /// /// A member's status in the account. /// [JsonProperty("status")] public MemberStatus? Status { get; set; } /// /// Details of the user associated to the membership. /// [JsonProperty("user")] public MemberUser? User { get; set; } } /// /// A member's access policy. /// Source /// public class MemberPolicy { /// /// Policy identifier. /// [JsonProperty("id")] public string? Id { get; set; } /// /// Allow or deny operations against the resources. /// [JsonProperty("access")] public MemberPolicyAccess? Access { get; set; } /// /// A set of permission groups that are specified to the policy. /// [JsonProperty("permission_groups")] public IReadOnlyCollection? PermissionGroups { get; set; } /// /// A list of resource groups that the policy applies to. /// [JsonProperty("resource_groups")] public IReadOnlyCollection? ResourceGroups { get; set; } } /// /// A member's status. /// Source /// [JsonConverter(typeof(StringEnumConverter))] public enum MemberStatus { /// /// The member has accepted the invitation. /// [EnumMember(Value = "accepted")] Accepted = 1, /// /// The member has not yet accepted the invitation. /// [EnumMember(Value = "pending")] Pending = 2 } /// /// A member's policy access. /// Source /// [JsonConverter(typeof(StringEnumConverter))] public enum MemberPolicyAccess { /// /// Allow operations against the resource. /// [EnumMember(Value = "allow")] Allow = 1, /// /// Deny operations against the resource. /// [EnumMember(Value = "deny")] Deny = 2 } /// /// A member's permission group. /// Source /// public class MemberPolicyPermissionGroup { /// /// Initializes a new instance of the class. /// /// Identifier of the permission group. public MemberPolicyPermissionGroup(string id) { Id = id; } /// /// Identifier of the permission group. /// [JsonProperty("id")] public string Id { get; set; } /// /// Attributes associated to the permission group. /// [JsonProperty("meta")] public MemberPolicyPermissionGroupMeta? Meta { get; set; } /// /// Name of the permission group. /// [JsonProperty("name")] public string? Name { get; set; } } /// /// Attributes associated to the permission group. /// Source /// public class MemberPolicyPermissionGroupMeta { /// /// The key of the attribute. /// [JsonProperty("key")] public string? Key { get; set; } /// /// The value of the attribute. /// [JsonProperty("value")] public string? Value { get; set; } } /// /// A group of scoped resources. /// Source /// public class MemberPolicyResourceGroup { /// /// Initializes a new instance of the class. /// /// Identifier of the resource group. public MemberPolicyResourceGroup(string id) { Id = id; } /// /// Identifier of the resource group. /// [JsonProperty("id")] public string Id { get; set; } /// /// The scope associated to the resource group. /// [JsonProperty("scope")] public IReadOnlyCollection Scope { get; set; } = []; /// /// Attributes associated to the resource group. /// [JsonProperty("meta")] public MemberPolicyResourceGroupMeta? Meta { get; set; } /// /// Name of the resource group. /// [JsonProperty("name")] public string? Name { get; set; } } /// /// Attributes associated to the resource group. /// Source /// public class MemberPolicyResourceGroupScope { /// /// Initializes a new instance of the class. /// /// Combination of pre-defined resource name and identifier. public MemberPolicyResourceGroupScope(string key) { Key = key; } /// /// This is a combination of pre-defined resource name and identifier (like Account ID etc.) /// [JsonProperty("key")] public string Key { get; set; } /// /// A list of scope objects for additional context. /// [JsonProperty("objects")] public IReadOnlyCollection Objects { get; set; } = []; } /// /// A scope object for additional context. /// Source /// public class MemberPolicyResourceGroupScopeObject { /// /// Initializes a new instance of the class. /// /// Combination of pre-defined resource name and identifier. public MemberPolicyResourceGroupScopeObject(string key) { Key = key; } /// /// This is a combination of pre-defined resource name and identifier (like Zone ID etc.) /// [JsonProperty("key")] public string Key { get; set; } } /// /// Attributes associated to the resource group. /// public class MemberPolicyResourceGroupMeta { /// /// The key of the attribute. /// [JsonProperty("key")] public string? Key { get; set; } /// /// The value of the attribute. /// [JsonProperty("value")] public string? Value { get; set; } } /// /// Details of the user associated to the membership. /// Source /// public class MemberUser { /// /// Initializes a new instance of the class. /// /// The contact email address of the user. public MemberUser(string email) { Email = email; } /// /// The contact email address of the user. /// [JsonProperty("email")] public string Email { get; set; } /// /// Identifier. /// [JsonProperty("id")] public string? Id { get; set; } /// /// User's first name. /// [JsonProperty("first_name")] public string? FirstName { get; set; } /// /// User's last name. /// [JsonProperty("last_name")] public string? LastName { get; set; } /// /// Indicates whether two-factor authentication is enabled for the user account. /// Does not apply to API authentication. /// [JsonProperty("two_factor_authentication_enabled")] public bool? TwoFactorAuthEnabled { get; set; } } }