<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/cloudtrace/v2/trace.proto

namespace Google\Cloud\Trace\V2\Span;

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

/**
 * A set of attributes as key-value pairs.
 *
 * Generated from protobuf message <code>google.devtools.cloudtrace.v2.Span.Attributes</code>
 */
class Attributes extends \Google\Protobuf\Internal\Message
{
    /**
     * A set of attributes. Each attribute's key can be up to 128 bytes
     * long. The value can be a string up to 256 bytes, a signed 64-bit integer,
     * or the boolean values `true` or `false`. For example:
     *     "/instance_id": { "string_value": { "value": "my-instance" } }
     *     "/http/request_bytes": { "int_value": 300 }
     *     "abc.com/myattribute": { "bool_value": false }
     *
     * Generated from protobuf field <code>map<string, .google.devtools.cloudtrace.v2.AttributeValue> attribute_map = 1;</code>
     */
    private $attribute_map;
    /**
     * The number of attributes that were discarded. Attributes can be discarded
     * because their keys are too long or because there are too many attributes.
     * If this value is 0 then all attributes are valid.
     *
     * Generated from protobuf field <code>int32 dropped_attributes_count = 2;</code>
     */
    private $dropped_attributes_count = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array|\Google\Protobuf\Internal\MapField $attribute_map
     *           A set of attributes. Each attribute's key can be up to 128 bytes
     *           long. The value can be a string up to 256 bytes, a signed 64-bit integer,
     *           or the boolean values `true` or `false`. For example:
     *               "/instance_id": { "string_value": { "value": "my-instance" } }
     *               "/http/request_bytes": { "int_value": 300 }
     *               "abc.com/myattribute": { "bool_value": false }
     *     @type int $dropped_attributes_count
     *           The number of attributes that were discarded. Attributes can be discarded
     *           because their keys are too long or because there are too many attributes.
     *           If this value is 0 then all attributes are valid.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce();
        parent::__construct($data);
    }

    /**
     * A set of attributes. Each attribute's key can be up to 128 bytes
     * long. The value can be a string up to 256 bytes, a signed 64-bit integer,
     * or the boolean values `true` or `false`. For example:
     *     "/instance_id": { "string_value": { "value": "my-instance" } }
     *     "/http/request_bytes": { "int_value": 300 }
     *     "abc.com/myattribute": { "bool_value": false }
     *
     * Generated from protobuf field <code>map<string, .google.devtools.cloudtrace.v2.AttributeValue> attribute_map = 1;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getAttributeMap()
    {
        return $this->attribute_map;
    }

    /**
     * A set of attributes. Each attribute's key can be up to 128 bytes
     * long. The value can be a string up to 256 bytes, a signed 64-bit integer,
     * or the boolean values `true` or `false`. For example:
     *     "/instance_id": { "string_value": { "value": "my-instance" } }
     *     "/http/request_bytes": { "int_value": 300 }
     *     "abc.com/myattribute": { "bool_value": false }
     *
     * Generated from protobuf field <code>map<string, .google.devtools.cloudtrace.v2.AttributeValue> attribute_map = 1;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setAttributeMap($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\AttributeValue::class);
        $this->attribute_map = $arr;

        return $this;
    }

    /**
     * The number of attributes that were discarded. Attributes can be discarded
     * because their keys are too long or because there are too many attributes.
     * If this value is 0 then all attributes are valid.
     *
     * Generated from protobuf field <code>int32 dropped_attributes_count = 2;</code>
     * @return int
     */
    public function getDroppedAttributesCount()
    {
        return $this->dropped_attributes_count;
    }

    /**
     * The number of attributes that were discarded. Attributes can be discarded
     * because their keys are too long or because there are too many attributes.
     * If this value is 0 then all attributes are valid.
     *
     * Generated from protobuf field <code>int32 dropped_attributes_count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setDroppedAttributesCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->dropped_attributes_count = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Attributes::class, \Google\Cloud\Trace\V2\Span_Attributes::class);

