//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
//
namespace k8s.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
///
/// 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.
///
public partial class V1beta1PolicyRule
{
///
/// Initializes a new instance of the V1beta1PolicyRule class.
///
public V1beta1PolicyRule()
{
CustomInit();
}
///
/// Initializes a new instance of the V1beta1PolicyRule class.
///
/// Verbs is a list of Verbs that apply to ALL the
/// ResourceKinds and AttributeRestrictions contained in this rule.
/// VerbAll represents all kinds.
/// 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.
/// 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. Rules can either apply to API
/// resources (such as "pods" or "secrets") or non-resource URL paths
/// (such as "/api"), but not both.
/// ResourceNames is an optional white list
/// of names that the rule applies to. An empty set means that
/// everything is allowed.
/// Resources is a list of resources this rule
/// applies to. '*' represents all resources in the specified
/// apiGroups. '*/foo' represents the subresource 'foo' for all
/// resources in the specified apiGroups.
public V1beta1PolicyRule(IList verbs, IList apiGroups = default(IList), IList nonResourceURLs = default(IList), IList resourceNames = default(IList), IList resources = default(IList))
{
ApiGroups = apiGroups;
NonResourceURLs = nonResourceURLs;
ResourceNames = resourceNames;
Resources = resources;
Verbs = verbs;
CustomInit();
}
///
/// An initialization method that performs custom operations like setting defaults
///
partial void CustomInit();
///
/// Gets or sets 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.
///
[JsonProperty(PropertyName = "apiGroups")]
public IList ApiGroups { get; set; }
///
/// Gets or sets 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. Rules can either apply to API resources (such
/// as "pods" or "secrets") or non-resource URL paths (such as "/api"),
/// but not both.
///
[JsonProperty(PropertyName = "nonResourceURLs")]
public IList NonResourceURLs { get; set; }
///
/// Gets or sets resourceNames is an optional white list of names that
/// the rule applies to. An empty set means that everything is
/// allowed.
///
[JsonProperty(PropertyName = "resourceNames")]
public IList ResourceNames { get; set; }
///
/// Gets or sets resources is a list of resources this rule applies to.
/// '*' represents all resources in the specified apiGroups. '*/foo'
/// represents the subresource 'foo' for all resources in the specified
/// apiGroups.
///
[JsonProperty(PropertyName = "resources")]
public IList Resources { get; set; }
///
/// Gets or sets verbs is a list of Verbs that apply to ALL the
/// ResourceKinds and AttributeRestrictions contained in this rule.
/// VerbAll represents all kinds.
///
[JsonProperty(PropertyName = "verbs")]
public IList Verbs { get; set; }
///
/// Validate the object.
///
///
/// Thrown if validation fails
///
public virtual void Validate()
{
if (Verbs == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Verbs");
}
}
}
}