<commit_before>package api

const (
	APIGroupAll        = "*"
	ResourceAll        = "*"
	VerbAll            = "*"
	NonResourceAll     = "*"
	NamespaceAll       = "*"
	GroupKind          = "Group"
	ServiceAccountKind = "ServiceAccount"
	UserKind           = "User"
)

// PolicyRule holds information that describes a policy rule, but does not contain information
// about who the rule applies to or which namespace the rule applies to.
type PolicyRule struct {
	// Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule.  VerbAll represents all kinds.
	// Cannot be empty.
	Verbs []string `json:"verbs"`
	// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
	// the enumerated resources in any API group will be allowed. Cannot be empty.
	APIGroups []string `json:"apiGroups"`
	// Resources is a list of resources this rule applies to.  ResourceAll represents all resources. Cannot be empty.
	Resources []string `json:"resources"`
	// ResourceNames is an optional white list of names that the rule applies to.  An empty set means that everything is allowed.
	ResourceNames []string `json:"resourceNames,omitempty"`
	// NonResourceURLs is a set of partial urls that a user should have access to.  *s are allowed, but only as the full, final step in the path
	// Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding.
	NonResourceURLs []string `json:"nonResourceURLs,omitempty"`
}

// Subject contains a reference to the object or user identities a role binding applies to.  This can either hold a direct API object reference,
// or a value for non-objects such as user and group names.
type Subject struct {
	// Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount".
	// If the Authorizer does not recognize the kind value, the Authorizer should report an error.
	Kind string `json:"kind"`
	// Name of the object being referenced.
	Name string `json:"name"`
	// Namespace of the referenced object.  If the object kind is non-namespace, such as "User" or "Group", and this value is not empty
	// the Authorizer should report an error.
	Namespace string `json:"namespace,omitempty"`
}

// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
type Role struct {
	// Name of the role. Must be unique within the namespace.
	Name string `json:"name,omitempty"`
	// Namespace where this role exists.
	Namespace string `json:"namespace,omitempty"`
	// Rules holds all the PolicyRules for this Role
	Rules []PolicyRule `json:"rules"`
}

// RoleBinding references a role, but does not contain it.  It can reference a Role in the same namespace or a ClusterRole in the global namespace.
// It adds who information via Subjects and namespace information by which namespace it exists in.  RoleBindings in a given
// namespace only have effect in that namespace.
type RoleBinding struct {
	// Name of the role binding. Must be unique within the namespace.
	Name string `json:"name,omitempty"`
	// Namespace where this rolebinding exists.
	Namespace string `json:"namespace,omitempty"`
	// Subjects holds references to the objects the role applies to.
	Subjects []Subject `json:"subjects"`
	// Role in the current namespace or a ClusterRole in the global namespace.
	Role `json:"role"`
}<commit_msg>Fixed Role type to contain a Role<commit_after>package api

const (
	APIGroupAll        = "*"
	ResourceAll        = "*"
	VerbAll            = "*"
	NonResourceAll     = "*"
	NamespaceAll       = "*"
	GroupKind          = "Group"
	ServiceAccountKind = "ServiceAccount"
	UserKind           = "User"
)

// PolicyRule holds information that describes a policy rule, but does not contain information
// about who the rule applies to or which namespace the rule applies to.
type PolicyRule struct {
	// Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule.  VerbAll represents all kinds.
	// Cannot be empty.
	Verbs []string `json:"verbs"`
	// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
	// the enumerated resources in any API group will be allowed. Cannot be empty.
	APIGroups []string `json:"apiGroups"`
	// Resources is a list of resources this rule applies to.  ResourceAll represents all resources. Cannot be empty.
	Resources []string `json:"resources"`
	// ResourceNames is an optional white list of names that the rule applies to.  An empty set means that everything is allowed.
	ResourceNames []string `json:"resourceNames,omitempty"`
	// NonResourceURLs is a set of partial urls that a user should have access to.  *s are allowed, but only as the full, final step in the path
	// Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding.
	NonResourceURLs []string `json:"nonResourceURLs,omitempty"`
}

// Subject contains a reference to the object or user identities a role binding applies to.  This can either hold a direct API object reference,
// or a value for non-objects such as user and group names.
type Subject struct {
	// Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount".
	// If the Authorizer does not recognize the kind value, the Authorizer should report an error.
	Kind string `json:"kind"`
	// Name of the object being referenced.
	Name string `json:"name"`
	// Namespace of the referenced object.  If the object kind is non-namespace, such as "User" or "Group", and this value is not empty
	// the Authorizer should report an error.
	Namespace string `json:"namespace,omitempty"`
}

// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
type Role struct {
	// Name of the role. Must be unique within the namespace.
	Name string `json:"name,omitempty"`
	// Namespace where this role exists.
	Namespace string `json:"namespace,omitempty"`
	// Rules holds all the PolicyRules for this Role
	Rules []PolicyRule `json:"rules"`
}

// RoleBinding references a role, but does not contain it.  It can reference a Role in the same namespace or a ClusterRole in the global namespace.
// It adds who information via Subjects and namespace information by which namespace it exists in.  RoleBindings in a given
// namespace only have effect in that namespace.
type RoleBinding struct {
	// Name of the role binding. Must be unique within the namespace.
	Name string `json:"name,omitempty"`
	// Namespace where this rolebinding exists.
	Namespace string `json:"namespace,omitempty"`
	// Subjects holds references to the objects the role applies to.
	Subjects []Subject `json:"subjects"`
	// Role in the current namespace or a ClusterRole in the global namespace.
	Role Role `json:"role"`
}
{'fraction_non_alphanumeric': 0.07271694361596365, 'fraction_numerical': 0.0, 'mean_word_length': 3.843191196698762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3542617', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1768, 'n_words': 951}