// Code generated by mdatagen. DO NOT EDIT.

package metadata

import (
	"go.opentelemetry.io/collector/pdata/pcommon"
)

// ResourceBuilder is a helper struct to build resources predefined in metadata.yaml.
// The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.
type ResourceBuilder struct {
	config ResourceAttributesConfig
	res    pcommon.Resource
}

// NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.
func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder {
	return &ResourceBuilder{
		config: rac,
		res:    pcommon.NewResource(),
	}
}

// SetSerialID sets provided value as "SerialId" attribute.
func (rb *ResourceBuilder) SetSerialID(val string) {
	if rb.config.SerialID.Enabled {
		rb.res.Attributes().PutStr("SerialId", val)
	}
}

// SetVolumeID sets provided value as "VolumeId" attribute.
func (rb *ResourceBuilder) SetVolumeID(val string) {
	if rb.config.VolumeID.Enabled {
		rb.res.Attributes().PutStr("VolumeId", val)
	}
}

// Emit returns the built resource and resets the internal builder state.
func (rb *ResourceBuilder) Emit() pcommon.Resource {
	r := rb.res
	rb.res = pcommon.NewResource()
	return r
}
