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

namespace Google\Cloud\Batch\V1;

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

/**
 * Notification configurations.
 *
 * Generated from protobuf message <code>google.cloud.batch.v1.JobNotification</code>
 */
class JobNotification extends \Google\Protobuf\Internal\Message
{
    /**
     * The Pub/Sub topic where notifications for the job, like state
     * changes, will be published. If undefined, no Pub/Sub notifications
     * are sent for this job.
     * Specify the topic using the following format:
     * `projects/{project}/topics/{topic}`.
     * Notably, if you want to specify a Pub/Sub topic that is in a
     * different project than the job, your administrator must grant your
     * project's Batch service agent permission to publish to that topic.
     * For more information about configuring Pub/Sub notifications for
     * a job, see
     * https://cloud.google.com/batch/docs/enable-notifications.
     *
     * Generated from protobuf field <code>string pubsub_topic = 1;</code>
     */
    protected $pubsub_topic = '';
    /**
     * The attribute requirements of messages to be sent to this Pub/Sub topic.
     * Without this field, no message will be sent.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.JobNotification.Message message = 2;</code>
     */
    protected $message = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $pubsub_topic
     *           The Pub/Sub topic where notifications for the job, like state
     *           changes, will be published. If undefined, no Pub/Sub notifications
     *           are sent for this job.
     *           Specify the topic using the following format:
     *           `projects/{project}/topics/{topic}`.
     *           Notably, if you want to specify a Pub/Sub topic that is in a
     *           different project than the job, your administrator must grant your
     *           project's Batch service agent permission to publish to that topic.
     *           For more information about configuring Pub/Sub notifications for
     *           a job, see
     *           https://cloud.google.com/batch/docs/enable-notifications.
     *     @type \Google\Cloud\Batch\V1\JobNotification\Message $message
     *           The attribute requirements of messages to be sent to this Pub/Sub topic.
     *           Without this field, no message will be sent.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Batch\V1\Job::initOnce();
        parent::__construct($data);
    }

    /**
     * The Pub/Sub topic where notifications for the job, like state
     * changes, will be published. If undefined, no Pub/Sub notifications
     * are sent for this job.
     * Specify the topic using the following format:
     * `projects/{project}/topics/{topic}`.
     * Notably, if you want to specify a Pub/Sub topic that is in a
     * different project than the job, your administrator must grant your
     * project's Batch service agent permission to publish to that topic.
     * For more information about configuring Pub/Sub notifications for
     * a job, see
     * https://cloud.google.com/batch/docs/enable-notifications.
     *
     * Generated from protobuf field <code>string pubsub_topic = 1;</code>
     * @return string
     */
    public function getPubsubTopic()
    {
        return $this->pubsub_topic;
    }

    /**
     * The Pub/Sub topic where notifications for the job, like state
     * changes, will be published. If undefined, no Pub/Sub notifications
     * are sent for this job.
     * Specify the topic using the following format:
     * `projects/{project}/topics/{topic}`.
     * Notably, if you want to specify a Pub/Sub topic that is in a
     * different project than the job, your administrator must grant your
     * project's Batch service agent permission to publish to that topic.
     * For more information about configuring Pub/Sub notifications for
     * a job, see
     * https://cloud.google.com/batch/docs/enable-notifications.
     *
     * Generated from protobuf field <code>string pubsub_topic = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setPubsubTopic($var)
    {
        GPBUtil::checkString($var, True);
        $this->pubsub_topic = $var;

        return $this;
    }

    /**
     * The attribute requirements of messages to be sent to this Pub/Sub topic.
     * Without this field, no message will be sent.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.JobNotification.Message message = 2;</code>
     * @return \Google\Cloud\Batch\V1\JobNotification\Message|null
     */
    public function getMessage()
    {
        return $this->message;
    }

    public function hasMessage()
    {
        return isset($this->message);
    }

    public function clearMessage()
    {
        unset($this->message);
    }

    /**
     * The attribute requirements of messages to be sent to this Pub/Sub topic.
     * Without this field, no message will be sent.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.JobNotification.Message message = 2;</code>
     * @param \Google\Cloud\Batch\V1\JobNotification\Message $var
     * @return $this
     */
    public function setMessage($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\JobNotification\Message::class);
        $this->message = $var;

        return $this;
    }

}

