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

namespace Google\Cloud\Eventarc\V1;

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

/**
 * A representation of the trigger resource.
 *
 * Generated from protobuf message <code>google.cloud.eventarc.v1.Trigger</code>
 */
class Trigger extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource name of the trigger. Must be unique within the location of the
     * project and must be in
     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $name = '';
    /**
     * Output only. Server-assigned unique identifier for the trigger. The value is a UUID4
     * string and guaranteed to remain unchanged until the resource is deleted.
     *
     * Generated from protobuf field <code>string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $uid = '';
    /**
     * Output only. The creation time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $create_time = null;
    /**
     * Output only. The last-modified time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $update_time = null;
    /**
     * Required. Unordered list. The list of filters that applies to event attributes. Only events that
     * match all the provided filters are sent to the destination.
     *
     * Generated from protobuf field <code>repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED];</code>
     */
    private $event_filters;
    /**
     * Optional. The IAM service account email associated with the trigger. The
     * service account represents the identity of the trigger.
     * The principal who calls this API must have the `iam.serviceAccounts.actAs`
     * permission in the service account. See
     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
     * for more information.
     * For Cloud Run destinations, this service account is used to generate
     * identity tokens when invoking the service. See
     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
     * for information on how to invoke authenticated Cloud Run services.
     * To create Audit Log triggers, the service account should also
     * have the `roles/eventarc.eventReceiver` IAM role.
     *
     * Generated from protobuf field <code>string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     */
    private $service_account = '';
    /**
     * Required. Destination specifies where the events should be sent to.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $destination = null;
    /**
     * Optional. To deliver messages, Eventarc might use other GCP
     * products as a transport intermediary. This field contains a reference to
     * that transport intermediary. This information can be used for debugging
     * purposes.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $transport = null;
    /**
     * Optional. User labels attached to the triggers that can be used to group resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $labels;
    /**
     * Optional. The name of the channel associated with the trigger in
     * `projects/{project}/locations/{location}/channels/{channel}` format.
     * You must provide a channel to receive events from Eventarc SaaS partners.
     *
     * Generated from protobuf field <code>string channel = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $channel = '';
    /**
     * Output only. The reason(s) why a trigger is in FAILED state.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.eventarc.v1.StateCondition> conditions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $conditions;
    /**
     * Output only. This checksum is computed by the server based on the value of other
     * fields, and might be sent only on create requests to ensure that the
     * client has an up-to-date value before proceeding.
     *
     * Generated from protobuf field <code>string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $etag = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The resource name of the trigger. Must be unique within the location of the
     *           project and must be in
     *           `projects/{project}/locations/{location}/triggers/{trigger}` format.
     *     @type string $uid
     *           Output only. Server-assigned unique identifier for the trigger. The value is a UUID4
     *           string and guaranteed to remain unchanged until the resource is deleted.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. The creation time.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           Output only. The last-modified time.
     *     @type array<\Google\Cloud\Eventarc\V1\EventFilter>|\Google\Protobuf\Internal\RepeatedField $event_filters
     *           Required. Unordered list. The list of filters that applies to event attributes. Only events that
     *           match all the provided filters are sent to the destination.
     *     @type string $service_account
     *           Optional. The IAM service account email associated with the trigger. The
     *           service account represents the identity of the trigger.
     *           The principal who calls this API must have the `iam.serviceAccounts.actAs`
     *           permission in the service account. See
     *           https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
     *           for more information.
     *           For Cloud Run destinations, this service account is used to generate
     *           identity tokens when invoking the service. See
     *           https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
     *           for information on how to invoke authenticated Cloud Run services.
     *           To create Audit Log triggers, the service account should also
     *           have the `roles/eventarc.eventReceiver` IAM role.
     *     @type \Google\Cloud\Eventarc\V1\Destination $destination
     *           Required. Destination specifies where the events should be sent to.
     *     @type \Google\Cloud\Eventarc\V1\Transport $transport
     *           Optional. To deliver messages, Eventarc might use other GCP
     *           products as a transport intermediary. This field contains a reference to
     *           that transport intermediary. This information can be used for debugging
     *           purposes.
     *     @type array|\Google\Protobuf\Internal\MapField $labels
     *           Optional. User labels attached to the triggers that can be used to group resources.
     *     @type string $channel
     *           Optional. The name of the channel associated with the trigger in
     *           `projects/{project}/locations/{location}/channels/{channel}` format.
     *           You must provide a channel to receive events from Eventarc SaaS partners.
     *     @type array|\Google\Protobuf\Internal\MapField $conditions
     *           Output only. The reason(s) why a trigger is in FAILED state.
     *     @type string $etag
     *           Output only. This checksum is computed by the server based on the value of other
     *           fields, and might be sent only on create requests to ensure that the
     *           client has an up-to-date value before proceeding.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Eventarc\V1\Trigger::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The resource name of the trigger. Must be unique within the location of the
     * project and must be in
     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The resource name of the trigger. Must be unique within the location of the
     * project and must be in
     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. Server-assigned unique identifier for the trigger. The value is a UUID4
     * string and guaranteed to remain unchanged until the resource is deleted.
     *
     * Generated from protobuf field <code>string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getUid()
    {
        return $this->uid;
    }

    /**
     * Output only. Server-assigned unique identifier for the trigger. The value is a UUID4
     * string and guaranteed to remain unchanged until the resource is deleted.
     *
     * Generated from protobuf field <code>string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setUid($var)
    {
        GPBUtil::checkString($var, True);
        $this->uid = $var;

        return $this;
    }

    /**
     * Output only. The creation time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. The creation time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Output only. The last-modified time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * Output only. The last-modified time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Required. Unordered list. The list of filters that applies to event attributes. Only events that
     * match all the provided filters are sent to the destination.
     *
     * Generated from protobuf field <code>repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getEventFilters()
    {
        return $this->event_filters;
    }

    /**
     * Required. Unordered list. The list of filters that applies to event attributes. Only events that
     * match all the provided filters are sent to the destination.
     *
     * Generated from protobuf field <code>repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\Eventarc\V1\EventFilter>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setEventFilters($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Eventarc\V1\EventFilter::class);
        $this->event_filters = $arr;

        return $this;
    }

    /**
     * Optional. The IAM service account email associated with the trigger. The
     * service account represents the identity of the trigger.
     * The principal who calls this API must have the `iam.serviceAccounts.actAs`
     * permission in the service account. See
     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
     * for more information.
     * For Cloud Run destinations, this service account is used to generate
     * identity tokens when invoking the service. See
     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
     * for information on how to invoke authenticated Cloud Run services.
     * To create Audit Log triggers, the service account should also
     * have the `roles/eventarc.eventReceiver` IAM role.
     *
     * Generated from protobuf field <code>string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getServiceAccount()
    {
        return $this->service_account;
    }

    /**
     * Optional. The IAM service account email associated with the trigger. The
     * service account represents the identity of the trigger.
     * The principal who calls this API must have the `iam.serviceAccounts.actAs`
     * permission in the service account. See
     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
     * for more information.
     * For Cloud Run destinations, this service account is used to generate
     * identity tokens when invoking the service. See
     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
     * for information on how to invoke authenticated Cloud Run services.
     * To create Audit Log triggers, the service account should also
     * have the `roles/eventarc.eventReceiver` IAM role.
     *
     * Generated from protobuf field <code>string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setServiceAccount($var)
    {
        GPBUtil::checkString($var, True);
        $this->service_account = $var;

        return $this;
    }

    /**
     * Required. Destination specifies where the events should be sent to.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Eventarc\V1\Destination|null
     */
    public function getDestination()
    {
        return $this->destination;
    }

    public function hasDestination()
    {
        return isset($this->destination);
    }

    public function clearDestination()
    {
        unset($this->destination);
    }

    /**
     * Required. Destination specifies where the events should be sent to.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Eventarc\V1\Destination $var
     * @return $this
     */
    public function setDestination($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Eventarc\V1\Destination::class);
        $this->destination = $var;

        return $this;
    }

    /**
     * Optional. To deliver messages, Eventarc might use other GCP
     * products as a transport intermediary. This field contains a reference to
     * that transport intermediary. This information can be used for debugging
     * purposes.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Eventarc\V1\Transport|null
     */
    public function getTransport()
    {
        return $this->transport;
    }

    public function hasTransport()
    {
        return isset($this->transport);
    }

    public function clearTransport()
    {
        unset($this->transport);
    }

    /**
     * Optional. To deliver messages, Eventarc might use other GCP
     * products as a transport intermediary. This field contains a reference to
     * that transport intermediary. This information can be used for debugging
     * purposes.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Eventarc\V1\Transport $var
     * @return $this
     */
    public function setTransport($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Eventarc\V1\Transport::class);
        $this->transport = $var;

        return $this;
    }

    /**
     * Optional. User labels attached to the triggers that can be used to group resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLabels()
    {
        return $this->labels;
    }

    /**
     * Optional. User labels attached to the triggers that can be used to group resources.
     *
     * Generated from protobuf field <code>map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLabels($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->labels = $arr;

        return $this;
    }

    /**
     * Optional. The name of the channel associated with the trigger in
     * `projects/{project}/locations/{location}/channels/{channel}` format.
     * You must provide a channel to receive events from Eventarc SaaS partners.
     *
     * Generated from protobuf field <code>string channel = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getChannel()
    {
        return $this->channel;
    }

    /**
     * Optional. The name of the channel associated with the trigger in
     * `projects/{project}/locations/{location}/channels/{channel}` format.
     * You must provide a channel to receive events from Eventarc SaaS partners.
     *
     * Generated from protobuf field <code>string channel = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setChannel($var)
    {
        GPBUtil::checkString($var, True);
        $this->channel = $var;

        return $this;
    }

    /**
     * Output only. The reason(s) why a trigger is in FAILED state.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.eventarc.v1.StateCondition> conditions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getConditions()
    {
        return $this->conditions;
    }

    /**
     * Output only. The reason(s) why a trigger is in FAILED state.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.eventarc.v1.StateCondition> conditions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setConditions($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Eventarc\V1\StateCondition::class);
        $this->conditions = $arr;

        return $this;
    }

    /**
     * Output only. This checksum is computed by the server based on the value of other
     * fields, and might be sent only on create requests to ensure that the
     * client has an up-to-date value before proceeding.
     *
     * Generated from protobuf field <code>string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getEtag()
    {
        return $this->etag;
    }

    /**
     * Output only. This checksum is computed by the server based on the value of other
     * fields, and might be sent only on create requests to ensure that the
     * client has an up-to-date value before proceeding.
     *
     * Generated from protobuf field <code>string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setEtag($var)
    {
        GPBUtil::checkString($var, True);
        $this->etag = $var;

        return $this;
    }

}

