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

namespace Google\Cloud\Functions\V1;

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

/**
 * Describes the policy in case of function's execution failure.
 * If empty, then defaults to ignoring failures (i.e. not retrying them).
 *
 * Generated from protobuf message <code>google.cloud.functions.v1.FailurePolicy</code>
 */
class FailurePolicy extends \Google\Protobuf\Internal\Message
{
    protected $action;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry
     *           If specified, then the function will be retried in case of a failure.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Functions\V1\Functions::initOnce();
        parent::__construct($data);
    }

    /**
     * If specified, then the function will be retried in case of a failure.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v1.FailurePolicy.Retry retry = 1;</code>
     * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null
     */
    public function getRetry()
    {
        return $this->readOneof(1);
    }

    public function hasRetry()
    {
        return $this->hasOneof(1);
    }

    /**
     * If specified, then the function will be retried in case of a failure.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v1.FailurePolicy.Retry retry = 1;</code>
     * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var
     * @return $this
     */
    public function setRetry($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Functions\V1\FailurePolicy\Retry::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getAction()
    {
        return $this->whichOneof("action");
    }

}

