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

namespace Google\Cloud\PubSub\V1\IngestionFailureEvent;

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

/**
 * Failure when ingesting from an AWS Kinesis source.
 *
 * Generated from protobuf message <code>google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason</code>
 */
class AwsKinesisFailureReason extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The stream ARN of the Kinesis stream being ingested from.
     *
     * Generated from protobuf field <code>string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $stream_arn = '';
    /**
     * Optional. The partition key of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $partition_key = '';
    /**
     * Optional. The sequence number of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $sequence_number = '';
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $stream_arn
     *           Optional. The stream ARN of the Kinesis stream being ingested from.
     *     @type string $partition_key
     *           Optional. The partition key of the message that failed to be ingested.
     *     @type string $sequence_number
     *           Optional. The sequence number of the message that failed to be ingested.
     *     @type \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason $schema_violation_reason
     *           Optional. The Pub/Sub message failed schema validation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The stream ARN of the Kinesis stream being ingested from.
     *
     * Generated from protobuf field <code>string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getStreamArn()
    {
        return $this->stream_arn;
    }

    /**
     * Optional. The stream ARN of the Kinesis stream being ingested from.
     *
     * Generated from protobuf field <code>string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setStreamArn($var)
    {
        GPBUtil::checkString($var, True);
        $this->stream_arn = $var;

        return $this;
    }

    /**
     * Optional. The partition key of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getPartitionKey()
    {
        return $this->partition_key;
    }

    /**
     * Optional. The partition key of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setPartitionKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->partition_key = $var;

        return $this;
    }

    /**
     * Optional. The sequence number of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getSequenceNumber()
    {
        return $this->sequence_number;
    }

    /**
     * Optional. The sequence number of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setSequenceNumber($var)
    {
        GPBUtil::checkString($var, True);
        $this->sequence_number = $var;

        return $this;
    }

    /**
     * Optional. The Pub/Sub message failed schema validation.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason|null
     */
    public function getSchemaViolationReason()
    {
        return $this->readOneof(4);
    }

    public function hasSchemaViolationReason()
    {
        return $this->hasOneof(4);
    }

    /**
     * Optional. The Pub/Sub message failed schema validation.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason $var
     * @return $this
     */
    public function setSchemaViolationReason($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason::class);
        $this->writeOneof(4, $var);

        return $this;
    }

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

}


