<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/securitycenter/v1/kubernetes.proto

namespace Google\Cloud\SecurityCenter\V1\Kubernetes;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Represents a Kubernetes RoleBinding or ClusterRoleBinding.
 *
 * Generated from protobuf message <code>google.cloud.securitycenter.v1.Kubernetes.Binding</code>
 */
class Binding extends \Google\Protobuf\Internal\Message
{
    /**
     * Namespace for binding.
     *
     * Generated from protobuf field <code>string ns = 1;</code>
     */
    private $ns = '';
    /**
     * Name for binding.
     *
     * Generated from protobuf field <code>string name = 2;</code>
     */
    private $name = '';
    /**
     * The Role or ClusterRole referenced by the binding.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Kubernetes.Role role = 3;</code>
     */
    private $role = null;
    /**
     * Represents the subjects(s) bound to the role. Not always available
     * for PATCH requests.
     *
     * Generated from protobuf field <code>repeated .google.cloud.securitycenter.v1.Kubernetes.Subject subjects = 4;</code>
     */
    private $subjects;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $ns
     *           Namespace for binding.
     *     @type string $name
     *           Name for binding.
     *     @type \Google\Cloud\SecurityCenter\V1\Kubernetes\Role $role
     *           The Role or ClusterRole referenced by the binding.
     *     @type array<\Google\Cloud\SecurityCenter\V1\Kubernetes\Subject>|\Google\Protobuf\Internal\RepeatedField $subjects
     *           Represents the subjects(s) bound to the role. Not always available
     *           for PATCH requests.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Securitycenter\V1\Kubernetes::initOnce();
        parent::__construct($data);
    }

    /**
     * Namespace for binding.
     *
     * Generated from protobuf field <code>string ns = 1;</code>
     * @return string
     */
    public function getNs()
    {
        return $this->ns;
    }

    /**
     * Namespace for binding.
     *
     * Generated from protobuf field <code>string ns = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setNs($var)
    {
        GPBUtil::checkString($var, True);
        $this->ns = $var;

        return $this;
    }

    /**
     * Name for binding.
     *
     * Generated from protobuf field <code>string name = 2;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Name for binding.
     *
     * Generated from protobuf field <code>string name = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The Role or ClusterRole referenced by the binding.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Kubernetes.Role role = 3;</code>
     * @return \Google\Cloud\SecurityCenter\V1\Kubernetes\Role|null
     */
    public function getRole()
    {
        return $this->role;
    }

    public function hasRole()
    {
        return isset($this->role);
    }

    public function clearRole()
    {
        unset($this->role);
    }

    /**
     * The Role or ClusterRole referenced by the binding.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1.Kubernetes.Role role = 3;</code>
     * @param \Google\Cloud\SecurityCenter\V1\Kubernetes\Role $var
     * @return $this
     */
    public function setRole($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1\Kubernetes\Role::class);
        $this->role = $var;

        return $this;
    }

    /**
     * Represents the subjects(s) bound to the role. Not always available
     * for PATCH requests.
     *
     * Generated from protobuf field <code>repeated .google.cloud.securitycenter.v1.Kubernetes.Subject subjects = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getSubjects()
    {
        return $this->subjects;
    }

    /**
     * Represents the subjects(s) bound to the role. Not always available
     * for PATCH requests.
     *
     * Generated from protobuf field <code>repeated .google.cloud.securitycenter.v1.Kubernetes.Subject subjects = 4;</code>
     * @param array<\Google\Cloud\SecurityCenter\V1\Kubernetes\Subject>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setSubjects($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1\Kubernetes\Subject::class);
        $this->subjects = $arr;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Binding::class, \Google\Cloud\SecurityCenter\V1\Kubernetes_Binding::class);

