<?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;

/**
 * Represents a Pub/Sub transport.
 *
 * Generated from protobuf message <code>google.cloud.eventarc.v1.Pubsub</code>
 */
class Pubsub extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The name of the Pub/Sub topic created and managed by Eventarc as
     * a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
     * You can set an existing topic for triggers of the type
     * `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
     * here is not deleted by Eventarc at trigger deletion.
     *
     * Generated from protobuf field <code>string topic = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $topic = '';
    /**
     * Output only. The name of the Pub/Sub subscription created and managed by Eventarc
     * as a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
     *
     * Generated from protobuf field <code>string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $subscription = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $topic
     *           Optional. The name of the Pub/Sub topic created and managed by Eventarc as
     *           a transport for the event delivery. Format:
     *           `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
     *           You can set an existing topic for triggers of the type
     *           `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
     *           here is not deleted by Eventarc at trigger deletion.
     *     @type string $subscription
     *           Output only. The name of the Pub/Sub subscription created and managed by Eventarc
     *           as a transport for the event delivery. Format:
     *           `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Eventarc\V1\Trigger::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The name of the Pub/Sub topic created and managed by Eventarc as
     * a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
     * You can set an existing topic for triggers of the type
     * `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
     * here is not deleted by Eventarc at trigger deletion.
     *
     * Generated from protobuf field <code>string topic = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getTopic()
    {
        return $this->topic;
    }

    /**
     * Optional. The name of the Pub/Sub topic created and managed by Eventarc as
     * a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
     * You can set an existing topic for triggers of the type
     * `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
     * here is not deleted by Eventarc at trigger deletion.
     *
     * Generated from protobuf field <code>string topic = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setTopic($var)
    {
        GPBUtil::checkString($var, True);
        $this->topic = $var;

        return $this;
    }

    /**
     * Output only. The name of the Pub/Sub subscription created and managed by Eventarc
     * as a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
     *
     * Generated from protobuf field <code>string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getSubscription()
    {
        return $this->subscription;
    }

    /**
     * Output only. The name of the Pub/Sub subscription created and managed by Eventarc
     * as a transport for the event delivery. Format:
     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
     *
     * Generated from protobuf field <code>string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setSubscription($var)
    {
        GPBUtil::checkString($var, True);
        $this->subscription = $var;

        return $this;
    }

}

