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

namespace Google\Cloud\Compute\V1;

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

/**
 * The available logging options for this subnetwork.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.SubnetworkLogConfig</code>
 */
class SubnetworkLogConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Default is an interval of 5 seconds per connection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.AggregationInterval aggregation_interval = 174919042;</code>
     */
    private $aggregation_interval = null;
    /**
     * Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is to disable flow logging.
     *
     * Generated from protobuf field <code>bool enable = 311764355;</code>
     */
    private $enable = null;
    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Export filter used to define which VPC flow logs should be logged.
     *
     * Generated from protobuf field <code>string filter_expr = 183374428;</code>
     */
    private $filter_expr = null;
    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5, which means half of all collected logs are reported.
     *
     * Generated from protobuf field <code>float flow_sampling = 530150360;</code>
     */
    private $flow_sampling = null;
    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default is EXCLUDE_ALL_METADATA.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.Metadata metadata = 86866735;</code>
     */
    private $metadata = null;
    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" was set to CUSTOM_METADATA.
     *
     * Generated from protobuf field <code>repeated string metadata_fields = 378461641;</code>
     */
    private $metadata_fields;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $aggregation_interval
     *           Can only be specified if VPC flow logging for this subnetwork is enabled. Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Default is an interval of 5 seconds per connection.
     *     @type bool $enable
     *           Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is to disable flow logging.
     *     @type string $filter_expr
     *           Can only be specified if VPC flow logs for this subnetwork is enabled. Export filter used to define which VPC flow logs should be logged.
     *     @type float $flow_sampling
     *           Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5, which means half of all collected logs are reported.
     *     @type int $metadata
     *           Can only be specified if VPC flow logs for this subnetwork is enabled. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default is EXCLUDE_ALL_METADATA.
     *     @type string[]|\Google\Protobuf\Internal\RepeatedField $metadata_fields
     *           Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" was set to CUSTOM_METADATA.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Default is an interval of 5 seconds per connection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.AggregationInterval aggregation_interval = 174919042;</code>
     * @return int
     */
    public function getAggregationInterval()
    {
        return isset($this->aggregation_interval) ? $this->aggregation_interval : 0;
    }

    public function hasAggregationInterval()
    {
        return isset($this->aggregation_interval);
    }

    public function clearAggregationInterval()
    {
        unset($this->aggregation_interval);
    }

    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Default is an interval of 5 seconds per connection.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.AggregationInterval aggregation_interval = 174919042;</code>
     * @param int $var
     * @return $this
     */
    public function setAggregationInterval($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\SubnetworkLogConfig\AggregationInterval::class);
        $this->aggregation_interval = $var;

        return $this;
    }

    /**
     * Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is to disable flow logging.
     *
     * Generated from protobuf field <code>bool enable = 311764355;</code>
     * @return bool
     */
    public function getEnable()
    {
        return isset($this->enable) ? $this->enable : false;
    }

    public function hasEnable()
    {
        return isset($this->enable);
    }

    public function clearEnable()
    {
        unset($this->enable);
    }

    /**
     * Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is to disable flow logging.
     *
     * Generated from protobuf field <code>bool enable = 311764355;</code>
     * @param bool $var
     * @return $this
     */
    public function setEnable($var)
    {
        GPBUtil::checkBool($var);
        $this->enable = $var;

        return $this;
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Export filter used to define which VPC flow logs should be logged.
     *
     * Generated from protobuf field <code>string filter_expr = 183374428;</code>
     * @return string
     */
    public function getFilterExpr()
    {
        return isset($this->filter_expr) ? $this->filter_expr : '';
    }

    public function hasFilterExpr()
    {
        return isset($this->filter_expr);
    }

    public function clearFilterExpr()
    {
        unset($this->filter_expr);
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Export filter used to define which VPC flow logs should be logged.
     *
     * Generated from protobuf field <code>string filter_expr = 183374428;</code>
     * @param string $var
     * @return $this
     */
    public function setFilterExpr($var)
    {
        GPBUtil::checkString($var, True);
        $this->filter_expr = $var;

        return $this;
    }

    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5, which means half of all collected logs are reported.
     *
     * Generated from protobuf field <code>float flow_sampling = 530150360;</code>
     * @return float
     */
    public function getFlowSampling()
    {
        return isset($this->flow_sampling) ? $this->flow_sampling : 0.0;
    }

    public function hasFlowSampling()
    {
        return isset($this->flow_sampling);
    }

    public function clearFlowSampling()
    {
        unset($this->flow_sampling);
    }

    /**
     * Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5, which means half of all collected logs are reported.
     *
     * Generated from protobuf field <code>float flow_sampling = 530150360;</code>
     * @param float $var
     * @return $this
     */
    public function setFlowSampling($var)
    {
        GPBUtil::checkFloat($var);
        $this->flow_sampling = $var;

        return $this;
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default is EXCLUDE_ALL_METADATA.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.Metadata metadata = 86866735;</code>
     * @return int
     */
    public function getMetadata()
    {
        return isset($this->metadata) ? $this->metadata : 0;
    }

    public function hasMetadata()
    {
        return isset($this->metadata);
    }

    public function clearMetadata()
    {
        unset($this->metadata);
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default is EXCLUDE_ALL_METADATA.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SubnetworkLogConfig.Metadata metadata = 86866735;</code>
     * @param int $var
     * @return $this
     */
    public function setMetadata($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\SubnetworkLogConfig\Metadata::class);
        $this->metadata = $var;

        return $this;
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" was set to CUSTOM_METADATA.
     *
     * Generated from protobuf field <code>repeated string metadata_fields = 378461641;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getMetadataFields()
    {
        return $this->metadata_fields;
    }

    /**
     * Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" was set to CUSTOM_METADATA.
     *
     * Generated from protobuf field <code>repeated string metadata_fields = 378461641;</code>
     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setMetadataFields($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->metadata_fields = $arr;

        return $this;
    }

}

