// Code generated by protoc-gen-go. DO NOT EDIT.
// source: dmi/hw_management_service.proto

package dmi

import (
	context "context"
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	empty "github.com/golang/protobuf/ptypes/empty"
	grpc "google.golang.org/grpc"
	math "math"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

type PhysicalInventoryResponse_Reason int32

const (
	PhysicalInventoryResponse_UNDEFINED_REASON   PhysicalInventoryResponse_Reason = 0
	PhysicalInventoryResponse_UNKNOWN_DEVICE     PhysicalInventoryResponse_Reason = 1
	PhysicalInventoryResponse_INTERNAL_ERROR     PhysicalInventoryResponse_Reason = 2
	PhysicalInventoryResponse_DEVICE_UNREACHABLE PhysicalInventoryResponse_Reason = 3
)

var PhysicalInventoryResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "INTERNAL_ERROR",
	3: "DEVICE_UNREACHABLE",
}

var PhysicalInventoryResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"INTERNAL_ERROR":     2,
	"DEVICE_UNREACHABLE": 3,
}

func (x PhysicalInventoryResponse_Reason) String() string {
	return proto.EnumName(PhysicalInventoryResponse_Reason_name, int32(x))
}

func (PhysicalInventoryResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{1, 0}
}

type HWComponentInfoGetResponse_Reason int32

const (
	HWComponentInfoGetResponse_UNDEFINED_REASON   HWComponentInfoGetResponse_Reason = 0
	HWComponentInfoGetResponse_UNKNOWN_DEVICE     HWComponentInfoGetResponse_Reason = 1
	HWComponentInfoGetResponse_UNKNOWN_COMPONENT  HWComponentInfoGetResponse_Reason = 2
	HWComponentInfoGetResponse_INTERNAL_ERROR     HWComponentInfoGetResponse_Reason = 3
	HWComponentInfoGetResponse_DEVICE_UNREACHABLE HWComponentInfoGetResponse_Reason = 4
)

var HWComponentInfoGetResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "UNKNOWN_COMPONENT",
	3: "INTERNAL_ERROR",
	4: "DEVICE_UNREACHABLE",
}

var HWComponentInfoGetResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"UNKNOWN_COMPONENT":  2,
	"INTERNAL_ERROR":     3,
	"DEVICE_UNREACHABLE": 4,
}

func (x HWComponentInfoGetResponse_Reason) String() string {
	return proto.EnumName(HWComponentInfoGetResponse_Reason_name, int32(x))
}

func (HWComponentInfoGetResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{3, 0}
}

type HWComponentInfoSetResponse_Reason int32

const (
	HWComponentInfoSetResponse_UNDEFINED_REASON   HWComponentInfoSetResponse_Reason = 0
	HWComponentInfoSetResponse_UNKNOWN_DEVICE     HWComponentInfoSetResponse_Reason = 1
	HWComponentInfoSetResponse_UNKNOWN_COMPONENT  HWComponentInfoSetResponse_Reason = 2
	HWComponentInfoSetResponse_INVALID_PARAMS     HWComponentInfoSetResponse_Reason = 3
	HWComponentInfoSetResponse_INTERNAL_ERROR     HWComponentInfoSetResponse_Reason = 4
	HWComponentInfoSetResponse_DEVICE_UNREACHABLE HWComponentInfoSetResponse_Reason = 5
)

var HWComponentInfoSetResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "UNKNOWN_COMPONENT",
	3: "INVALID_PARAMS",
	4: "INTERNAL_ERROR",
	5: "DEVICE_UNREACHABLE",
}

var HWComponentInfoSetResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"UNKNOWN_COMPONENT":  2,
	"INVALID_PARAMS":     3,
	"INTERNAL_ERROR":     4,
	"DEVICE_UNREACHABLE": 5,
}

func (x HWComponentInfoSetResponse_Reason) String() string {
	return proto.EnumName(HWComponentInfoSetResponse_Reason_name, int32(x))
}

func (HWComponentInfoSetResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{5, 0}
}

type StartManagingDeviceResponse_Reason int32

const (
	StartManagingDeviceResponse_UNDEFINED_REASON StartManagingDeviceResponse_Reason = 0
	// DEVICE_ALREADY_MANAGED is returned when StartManagingDevice is called again for the same name AFTER a previously
	// successful StartManagingDevice operation
	StartManagingDeviceResponse_DEVICE_ALREADY_MANAGED StartManagingDeviceResponse_Reason = 1
	// OPERATION_ALREADY_IN_PROGRESS is returned when StartManagingDevice is called again for the same name BEFORE
	// a previous StartManagingDevice operation has completed
	StartManagingDeviceResponse_OPERATION_ALREADY_IN_PROGRESS StartManagingDeviceResponse_Reason = 2
	StartManagingDeviceResponse_INVALID_PARAMS                StartManagingDeviceResponse_Reason = 3
	StartManagingDeviceResponse_INTERNAL_ERROR                StartManagingDeviceResponse_Reason = 4
)

var StartManagingDeviceResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "DEVICE_ALREADY_MANAGED",
	2: "OPERATION_ALREADY_IN_PROGRESS",
	3: "INVALID_PARAMS",
	4: "INTERNAL_ERROR",
}

var StartManagingDeviceResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":              0,
	"DEVICE_ALREADY_MANAGED":        1,
	"OPERATION_ALREADY_IN_PROGRESS": 2,
	"INVALID_PARAMS":                3,
	"INTERNAL_ERROR":                4,
}

func (x StartManagingDeviceResponse_Reason) String() string {
	return proto.EnumName(StartManagingDeviceResponse_Reason_name, int32(x))
}

func (StartManagingDeviceResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{6, 0}
}

// The only case in which an error is expected is if the name of the
// device to be stopped is not found
type StopManagingDeviceResponse_Reason int32

const (
	StopManagingDeviceResponse_UNDEFINED_REASON StopManagingDeviceResponse_Reason = 0
	StopManagingDeviceResponse_UNKNOWN_DEVICE   StopManagingDeviceResponse_Reason = 1
)

var StopManagingDeviceResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
}

var StopManagingDeviceResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON": 0,
	"UNKNOWN_DEVICE":   1,
}

func (x StopManagingDeviceResponse_Reason) String() string {
	return proto.EnumName(StopManagingDeviceResponse_Reason_name, int32(x))
}

func (StopManagingDeviceResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{8, 0}
}

type SetRemoteEndpointResponse_Reason int32

const (
	SetRemoteEndpointResponse_UNDEFINED_REASON                SetRemoteEndpointResponse_Reason = 0
	SetRemoteEndpointResponse_UNKNOWN_DEVICE                  SetRemoteEndpointResponse_Reason = 1
	SetRemoteEndpointResponse_INTERNAL_ERROR                  SetRemoteEndpointResponse_Reason = 2
	SetRemoteEndpointResponse_LOGGING_ENDPOINT_ERROR          SetRemoteEndpointResponse_Reason = 3
	SetRemoteEndpointResponse_LOGGING_ENDPOINT_PROTOCOL_ERROR SetRemoteEndpointResponse_Reason = 4
	SetRemoteEndpointResponse_MSGBUS_ENDPOINT_ERROR           SetRemoteEndpointResponse_Reason = 5
	SetRemoteEndpointResponse_DEVICE_UNREACHABLE              SetRemoteEndpointResponse_Reason = 6
)

var SetRemoteEndpointResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "INTERNAL_ERROR",
	3: "LOGGING_ENDPOINT_ERROR",
	4: "LOGGING_ENDPOINT_PROTOCOL_ERROR",
	5: "MSGBUS_ENDPOINT_ERROR",
	6: "DEVICE_UNREACHABLE",
}

var SetRemoteEndpointResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":                0,
	"UNKNOWN_DEVICE":                  1,
	"INTERNAL_ERROR":                  2,
	"LOGGING_ENDPOINT_ERROR":          3,
	"LOGGING_ENDPOINT_PROTOCOL_ERROR": 4,
	"MSGBUS_ENDPOINT_ERROR":           5,
	"DEVICE_UNREACHABLE":              6,
}

func (x SetRemoteEndpointResponse_Reason) String() string {
	return proto.EnumName(SetRemoteEndpointResponse_Reason_name, int32(x))
}

func (SetRemoteEndpointResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{11, 0}
}

type GetLoggingEndpointResponse_Reason int32

const (
	GetLoggingEndpointResponse_UNDEFINED_REASON   GetLoggingEndpointResponse_Reason = 0
	GetLoggingEndpointResponse_UNKNOWN_DEVICE     GetLoggingEndpointResponse_Reason = 1
	GetLoggingEndpointResponse_INTERNAL_ERROR     GetLoggingEndpointResponse_Reason = 2
	GetLoggingEndpointResponse_DEVICE_UNREACHABLE GetLoggingEndpointResponse_Reason = 3
)

var GetLoggingEndpointResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "INTERNAL_ERROR",
	3: "DEVICE_UNREACHABLE",
}

var GetLoggingEndpointResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"INTERNAL_ERROR":     2,
	"DEVICE_UNREACHABLE": 3,
}

func (x GetLoggingEndpointResponse_Reason) String() string {
	return proto.EnumName(GetLoggingEndpointResponse_Reason_name, int32(x))
}

func (GetLoggingEndpointResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{12, 0}
}

type GetMsgBusEndpointResponse_Reason int32

const (
	GetMsgBusEndpointResponse_UNDEFINED_REASON   GetMsgBusEndpointResponse_Reason = 0
	GetMsgBusEndpointResponse_INTERNAL_ERROR     GetMsgBusEndpointResponse_Reason = 1
	GetMsgBusEndpointResponse_DEVICE_UNREACHABLE GetMsgBusEndpointResponse_Reason = 2
)

var GetMsgBusEndpointResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "INTERNAL_ERROR",
	2: "DEVICE_UNREACHABLE",
}

var GetMsgBusEndpointResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"INTERNAL_ERROR":     1,
	"DEVICE_UNREACHABLE": 2,
}

func (x GetMsgBusEndpointResponse_Reason) String() string {
	return proto.EnumName(GetMsgBusEndpointResponse_Reason_name, int32(x))
}

func (GetMsgBusEndpointResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{14, 0}
}

type SetLogLevelResponse_Reason int32

const (
	SetLogLevelResponse_UNDEFINED_REASON   SetLogLevelResponse_Reason = 0
	SetLogLevelResponse_UNKNOWN_DEVICE     SetLogLevelResponse_Reason = 1
	SetLogLevelResponse_INTERNAL_ERROR     SetLogLevelResponse_Reason = 2
	SetLogLevelResponse_UNKNOWN_LOG_ENTITY SetLogLevelResponse_Reason = 3
	SetLogLevelResponse_DEVICE_UNREACHABLE SetLogLevelResponse_Reason = 4
)

var SetLogLevelResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "INTERNAL_ERROR",
	3: "UNKNOWN_LOG_ENTITY",
	4: "DEVICE_UNREACHABLE",
}

var SetLogLevelResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"INTERNAL_ERROR":     2,
	"UNKNOWN_LOG_ENTITY": 3,
	"DEVICE_UNREACHABLE": 4,
}

func (x SetLogLevelResponse_Reason) String() string {
	return proto.EnumName(SetLogLevelResponse_Reason_name, int32(x))
}

func (SetLogLevelResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{17, 0}
}

type GetLogLevelResponse_Reason int32

const (
	GetLogLevelResponse_UNDEFINED_REASON   GetLogLevelResponse_Reason = 0
	GetLogLevelResponse_UNKNOWN_DEVICE     GetLogLevelResponse_Reason = 1
	GetLogLevelResponse_INTERNAL_ERROR     GetLogLevelResponse_Reason = 2
	GetLogLevelResponse_UNKNOWN_LOG_ENTITY GetLogLevelResponse_Reason = 3
	GetLogLevelResponse_DEVICE_UNREACHABLE GetLogLevelResponse_Reason = 4
)

var GetLogLevelResponse_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "UNKNOWN_DEVICE",
	2: "INTERNAL_ERROR",
	3: "UNKNOWN_LOG_ENTITY",
	4: "DEVICE_UNREACHABLE",
}

var GetLogLevelResponse_Reason_value = map[string]int32{
	"UNDEFINED_REASON":   0,
	"UNKNOWN_DEVICE":     1,
	"INTERNAL_ERROR":     2,
	"UNKNOWN_LOG_ENTITY": 3,
	"DEVICE_UNREACHABLE": 4,
}

func (x GetLogLevelResponse_Reason) String() string {
	return proto.EnumName(GetLogLevelResponse_Reason_name, int32(x))
}

func (GetLogLevelResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{19, 0}
}

type PhysicalInventoryRequest struct {
	DeviceUuid           *Uuid    `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *PhysicalInventoryRequest) Reset()         { *m = PhysicalInventoryRequest{} }
func (m *PhysicalInventoryRequest) String() string { return proto.CompactTextString(m) }
func (*PhysicalInventoryRequest) ProtoMessage()    {}
func (*PhysicalInventoryRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{0}
}

func (m *PhysicalInventoryRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_PhysicalInventoryRequest.Unmarshal(m, b)
}
func (m *PhysicalInventoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_PhysicalInventoryRequest.Marshal(b, m, deterministic)
}
func (m *PhysicalInventoryRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_PhysicalInventoryRequest.Merge(m, src)
}
func (m *PhysicalInventoryRequest) XXX_Size() int {
	return xxx_messageInfo_PhysicalInventoryRequest.Size(m)
}
func (m *PhysicalInventoryRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_PhysicalInventoryRequest.DiscardUnknown(m)
}

var xxx_messageInfo_PhysicalInventoryRequest proto.InternalMessageInfo

func (m *PhysicalInventoryRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

type PhysicalInventoryResponse struct {
	Status               Status                           `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               PhysicalInventoryResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.PhysicalInventoryResponse_Reason" json:"reason,omitempty"`
	Inventory            *Hardware                        `protobuf:"bytes,3,opt,name=inventory,proto3" json:"inventory,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                         `json:"-"`
	XXX_unrecognized     []byte                           `json:"-"`
	XXX_sizecache        int32                            `json:"-"`
}

func (m *PhysicalInventoryResponse) Reset()         { *m = PhysicalInventoryResponse{} }
func (m *PhysicalInventoryResponse) String() string { return proto.CompactTextString(m) }
func (*PhysicalInventoryResponse) ProtoMessage()    {}
func (*PhysicalInventoryResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{1}
}

func (m *PhysicalInventoryResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_PhysicalInventoryResponse.Unmarshal(m, b)
}
func (m *PhysicalInventoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_PhysicalInventoryResponse.Marshal(b, m, deterministic)
}
func (m *PhysicalInventoryResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_PhysicalInventoryResponse.Merge(m, src)
}
func (m *PhysicalInventoryResponse) XXX_Size() int {
	return xxx_messageInfo_PhysicalInventoryResponse.Size(m)
}
func (m *PhysicalInventoryResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_PhysicalInventoryResponse.DiscardUnknown(m)
}

var xxx_messageInfo_PhysicalInventoryResponse proto.InternalMessageInfo

func (m *PhysicalInventoryResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *PhysicalInventoryResponse) GetReason() PhysicalInventoryResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return PhysicalInventoryResponse_UNDEFINED_REASON
}

func (m *PhysicalInventoryResponse) GetInventory() *Hardware {
	if m != nil {
		return m.Inventory
	}
	return nil
}

type HWComponentInfoGetRequest struct {
	DeviceUuid           *Uuid    `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	ComponentUuid        *Uuid    `protobuf:"bytes,2,opt,name=component_uuid,json=componentUuid,proto3" json:"component_uuid,omitempty"`
	ComponentName        string   `protobuf:"bytes,3,opt,name=component_name,json=componentName,proto3" json:"component_name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *HWComponentInfoGetRequest) Reset()         { *m = HWComponentInfoGetRequest{} }
func (m *HWComponentInfoGetRequest) String() string { return proto.CompactTextString(m) }
func (*HWComponentInfoGetRequest) ProtoMessage()    {}
func (*HWComponentInfoGetRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{2}
}

func (m *HWComponentInfoGetRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_HWComponentInfoGetRequest.Unmarshal(m, b)
}
func (m *HWComponentInfoGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_HWComponentInfoGetRequest.Marshal(b, m, deterministic)
}
func (m *HWComponentInfoGetRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_HWComponentInfoGetRequest.Merge(m, src)
}
func (m *HWComponentInfoGetRequest) XXX_Size() int {
	return xxx_messageInfo_HWComponentInfoGetRequest.Size(m)
}
func (m *HWComponentInfoGetRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_HWComponentInfoGetRequest.DiscardUnknown(m)
}

var xxx_messageInfo_HWComponentInfoGetRequest proto.InternalMessageInfo

func (m *HWComponentInfoGetRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *HWComponentInfoGetRequest) GetComponentUuid() *Uuid {
	if m != nil {
		return m.ComponentUuid
	}
	return nil
}

func (m *HWComponentInfoGetRequest) GetComponentName() string {
	if m != nil {
		return m.ComponentName
	}
	return ""
}

type HWComponentInfoGetResponse struct {
	Status               Status                            `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               HWComponentInfoGetResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.HWComponentInfoGetResponse_Reason" json:"reason,omitempty"`
	Component            *Component                        `protobuf:"bytes,3,opt,name=component,proto3" json:"component,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                          `json:"-"`
	XXX_unrecognized     []byte                            `json:"-"`
	XXX_sizecache        int32                             `json:"-"`
}

func (m *HWComponentInfoGetResponse) Reset()         { *m = HWComponentInfoGetResponse{} }
func (m *HWComponentInfoGetResponse) String() string { return proto.CompactTextString(m) }
func (*HWComponentInfoGetResponse) ProtoMessage()    {}
func (*HWComponentInfoGetResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{3}
}

func (m *HWComponentInfoGetResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_HWComponentInfoGetResponse.Unmarshal(m, b)
}
func (m *HWComponentInfoGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_HWComponentInfoGetResponse.Marshal(b, m, deterministic)
}
func (m *HWComponentInfoGetResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_HWComponentInfoGetResponse.Merge(m, src)
}
func (m *HWComponentInfoGetResponse) XXX_Size() int {
	return xxx_messageInfo_HWComponentInfoGetResponse.Size(m)
}
func (m *HWComponentInfoGetResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_HWComponentInfoGetResponse.DiscardUnknown(m)
}

var xxx_messageInfo_HWComponentInfoGetResponse proto.InternalMessageInfo

func (m *HWComponentInfoGetResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *HWComponentInfoGetResponse) GetReason() HWComponentInfoGetResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return HWComponentInfoGetResponse_UNDEFINED_REASON
}

func (m *HWComponentInfoGetResponse) GetComponent() *Component {
	if m != nil {
		return m.Component
	}
	return nil
}

type HWComponentInfoSetRequest struct {
	DeviceUuid           *Uuid                `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	ComponentUuid        *Uuid                `protobuf:"bytes,2,opt,name=component_uuid,json=componentUuid,proto3" json:"component_uuid,omitempty"`
	ComponentName        string               `protobuf:"bytes,3,opt,name=component_name,json=componentName,proto3" json:"component_name,omitempty"`
	Changes              *ModifiableComponent `protobuf:"bytes,4,opt,name=changes,proto3" json:"changes,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (m *HWComponentInfoSetRequest) Reset()         { *m = HWComponentInfoSetRequest{} }
func (m *HWComponentInfoSetRequest) String() string { return proto.CompactTextString(m) }
func (*HWComponentInfoSetRequest) ProtoMessage()    {}
func (*HWComponentInfoSetRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{4}
}

func (m *HWComponentInfoSetRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_HWComponentInfoSetRequest.Unmarshal(m, b)
}
func (m *HWComponentInfoSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_HWComponentInfoSetRequest.Marshal(b, m, deterministic)
}
func (m *HWComponentInfoSetRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_HWComponentInfoSetRequest.Merge(m, src)
}
func (m *HWComponentInfoSetRequest) XXX_Size() int {
	return xxx_messageInfo_HWComponentInfoSetRequest.Size(m)
}
func (m *HWComponentInfoSetRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_HWComponentInfoSetRequest.DiscardUnknown(m)
}

var xxx_messageInfo_HWComponentInfoSetRequest proto.InternalMessageInfo

func (m *HWComponentInfoSetRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *HWComponentInfoSetRequest) GetComponentUuid() *Uuid {
	if m != nil {
		return m.ComponentUuid
	}
	return nil
}

func (m *HWComponentInfoSetRequest) GetComponentName() string {
	if m != nil {
		return m.ComponentName
	}
	return ""
}

func (m *HWComponentInfoSetRequest) GetChanges() *ModifiableComponent {
	if m != nil {
		return m.Changes
	}
	return nil
}

type HWComponentInfoSetResponse struct {
	Status               Status                            `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               HWComponentInfoSetResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.HWComponentInfoSetResponse_Reason" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                          `json:"-"`
	XXX_unrecognized     []byte                            `json:"-"`
	XXX_sizecache        int32                             `json:"-"`
}

func (m *HWComponentInfoSetResponse) Reset()         { *m = HWComponentInfoSetResponse{} }
func (m *HWComponentInfoSetResponse) String() string { return proto.CompactTextString(m) }
func (*HWComponentInfoSetResponse) ProtoMessage()    {}
func (*HWComponentInfoSetResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{5}
}

func (m *HWComponentInfoSetResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_HWComponentInfoSetResponse.Unmarshal(m, b)
}
func (m *HWComponentInfoSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_HWComponentInfoSetResponse.Marshal(b, m, deterministic)
}
func (m *HWComponentInfoSetResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_HWComponentInfoSetResponse.Merge(m, src)
}
func (m *HWComponentInfoSetResponse) XXX_Size() int {
	return xxx_messageInfo_HWComponentInfoSetResponse.Size(m)
}
func (m *HWComponentInfoSetResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_HWComponentInfoSetResponse.DiscardUnknown(m)
}

var xxx_messageInfo_HWComponentInfoSetResponse proto.InternalMessageInfo

func (m *HWComponentInfoSetResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *HWComponentInfoSetResponse) GetReason() HWComponentInfoSetResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return HWComponentInfoSetResponse_UNDEFINED_REASON
}

type StartManagingDeviceResponse struct {
	Status               Status                             `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               StartManagingDeviceResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.StartManagingDeviceResponse_Reason" json:"reason,omitempty"`
	DeviceUuid           *Uuid                              `protobuf:"bytes,3,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                           `json:"-"`
	XXX_unrecognized     []byte                             `json:"-"`
	XXX_sizecache        int32                              `json:"-"`
}

func (m *StartManagingDeviceResponse) Reset()         { *m = StartManagingDeviceResponse{} }
func (m *StartManagingDeviceResponse) String() string { return proto.CompactTextString(m) }
func (*StartManagingDeviceResponse) ProtoMessage()    {}
func (*StartManagingDeviceResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{6}
}

func (m *StartManagingDeviceResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_StartManagingDeviceResponse.Unmarshal(m, b)
}
func (m *StartManagingDeviceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_StartManagingDeviceResponse.Marshal(b, m, deterministic)
}
func (m *StartManagingDeviceResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_StartManagingDeviceResponse.Merge(m, src)
}
func (m *StartManagingDeviceResponse) XXX_Size() int {
	return xxx_messageInfo_StartManagingDeviceResponse.Size(m)
}
func (m *StartManagingDeviceResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_StartManagingDeviceResponse.DiscardUnknown(m)
}

var xxx_messageInfo_StartManagingDeviceResponse proto.InternalMessageInfo

func (m *StartManagingDeviceResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *StartManagingDeviceResponse) GetReason() StartManagingDeviceResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return StartManagingDeviceResponse_UNDEFINED_REASON
}

func (m *StartManagingDeviceResponse) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

type StopManagingDeviceRequest struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *StopManagingDeviceRequest) Reset()         { *m = StopManagingDeviceRequest{} }
func (m *StopManagingDeviceRequest) String() string { return proto.CompactTextString(m) }
func (*StopManagingDeviceRequest) ProtoMessage()    {}
func (*StopManagingDeviceRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{7}
}

func (m *StopManagingDeviceRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_StopManagingDeviceRequest.Unmarshal(m, b)
}
func (m *StopManagingDeviceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_StopManagingDeviceRequest.Marshal(b, m, deterministic)
}
func (m *StopManagingDeviceRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_StopManagingDeviceRequest.Merge(m, src)
}
func (m *StopManagingDeviceRequest) XXX_Size() int {
	return xxx_messageInfo_StopManagingDeviceRequest.Size(m)
}
func (m *StopManagingDeviceRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_StopManagingDeviceRequest.DiscardUnknown(m)
}

var xxx_messageInfo_StopManagingDeviceRequest proto.InternalMessageInfo

func (m *StopManagingDeviceRequest) GetName() string {
	if m != nil {
		return m.Name
	}
	return ""
}

type StopManagingDeviceResponse struct {
	Status               Status                            `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               StopManagingDeviceResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.StopManagingDeviceResponse_Reason" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                          `json:"-"`
	XXX_unrecognized     []byte                            `json:"-"`
	XXX_sizecache        int32                             `json:"-"`
}

func (m *StopManagingDeviceResponse) Reset()         { *m = StopManagingDeviceResponse{} }
func (m *StopManagingDeviceResponse) String() string { return proto.CompactTextString(m) }
func (*StopManagingDeviceResponse) ProtoMessage()    {}
func (*StopManagingDeviceResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{8}
}

func (m *StopManagingDeviceResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_StopManagingDeviceResponse.Unmarshal(m, b)
}
func (m *StopManagingDeviceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_StopManagingDeviceResponse.Marshal(b, m, deterministic)
}
func (m *StopManagingDeviceResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_StopManagingDeviceResponse.Merge(m, src)
}
func (m *StopManagingDeviceResponse) XXX_Size() int {
	return xxx_messageInfo_StopManagingDeviceResponse.Size(m)
}
func (m *StopManagingDeviceResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_StopManagingDeviceResponse.DiscardUnknown(m)
}

var xxx_messageInfo_StopManagingDeviceResponse proto.InternalMessageInfo

func (m *StopManagingDeviceResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *StopManagingDeviceResponse) GetReason() StopManagingDeviceResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return StopManagingDeviceResponse_UNDEFINED_REASON
}

type ManagedDevicesResponse struct {
	Devices              []*ModifiableComponent `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (m *ManagedDevicesResponse) Reset()         { *m = ManagedDevicesResponse{} }
func (m *ManagedDevicesResponse) String() string { return proto.CompactTextString(m) }
func (*ManagedDevicesResponse) ProtoMessage()    {}
func (*ManagedDevicesResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{9}
}

func (m *ManagedDevicesResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_ManagedDevicesResponse.Unmarshal(m, b)
}
func (m *ManagedDevicesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_ManagedDevicesResponse.Marshal(b, m, deterministic)
}
func (m *ManagedDevicesResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ManagedDevicesResponse.Merge(m, src)
}
func (m *ManagedDevicesResponse) XXX_Size() int {
	return xxx_messageInfo_ManagedDevicesResponse.Size(m)
}
func (m *ManagedDevicesResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_ManagedDevicesResponse.DiscardUnknown(m)
}

var xxx_messageInfo_ManagedDevicesResponse proto.InternalMessageInfo

func (m *ManagedDevicesResponse) GetDevices() []*ModifiableComponent {
	if m != nil {
		return m.Devices
	}
	return nil
}

type SetLoggingEndpointRequest struct {
	DeviceUuid           *Uuid    `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	LoggingEndpoint      string   `protobuf:"bytes,2,opt,name=logging_endpoint,json=loggingEndpoint,proto3" json:"logging_endpoint,omitempty"`
	LoggingProtocol      string   `protobuf:"bytes,3,opt,name=logging_protocol,json=loggingProtocol,proto3" json:"logging_protocol,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *SetLoggingEndpointRequest) Reset()         { *m = SetLoggingEndpointRequest{} }
func (m *SetLoggingEndpointRequest) String() string { return proto.CompactTextString(m) }
func (*SetLoggingEndpointRequest) ProtoMessage()    {}
func (*SetLoggingEndpointRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{10}
}

func (m *SetLoggingEndpointRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SetLoggingEndpointRequest.Unmarshal(m, b)
}
func (m *SetLoggingEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SetLoggingEndpointRequest.Marshal(b, m, deterministic)
}
func (m *SetLoggingEndpointRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SetLoggingEndpointRequest.Merge(m, src)
}
func (m *SetLoggingEndpointRequest) XXX_Size() int {
	return xxx_messageInfo_SetLoggingEndpointRequest.Size(m)
}
func (m *SetLoggingEndpointRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_SetLoggingEndpointRequest.DiscardUnknown(m)
}

var xxx_messageInfo_SetLoggingEndpointRequest proto.InternalMessageInfo

func (m *SetLoggingEndpointRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *SetLoggingEndpointRequest) GetLoggingEndpoint() string {
	if m != nil {
		return m.LoggingEndpoint
	}
	return ""
}

func (m *SetLoggingEndpointRequest) GetLoggingProtocol() string {
	if m != nil {
		return m.LoggingProtocol
	}
	return ""
}

type SetRemoteEndpointResponse struct {
	Status               Status                           `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               SetRemoteEndpointResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.SetRemoteEndpointResponse_Reason" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                         `json:"-"`
	XXX_unrecognized     []byte                           `json:"-"`
	XXX_sizecache        int32                            `json:"-"`
}

func (m *SetRemoteEndpointResponse) Reset()         { *m = SetRemoteEndpointResponse{} }
func (m *SetRemoteEndpointResponse) String() string { return proto.CompactTextString(m) }
func (*SetRemoteEndpointResponse) ProtoMessage()    {}
func (*SetRemoteEndpointResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{11}
}

func (m *SetRemoteEndpointResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SetRemoteEndpointResponse.Unmarshal(m, b)
}
func (m *SetRemoteEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SetRemoteEndpointResponse.Marshal(b, m, deterministic)
}
func (m *SetRemoteEndpointResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SetRemoteEndpointResponse.Merge(m, src)
}
func (m *SetRemoteEndpointResponse) XXX_Size() int {
	return xxx_messageInfo_SetRemoteEndpointResponse.Size(m)
}
func (m *SetRemoteEndpointResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_SetRemoteEndpointResponse.DiscardUnknown(m)
}

var xxx_messageInfo_SetRemoteEndpointResponse proto.InternalMessageInfo

func (m *SetRemoteEndpointResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *SetRemoteEndpointResponse) GetReason() SetRemoteEndpointResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return SetRemoteEndpointResponse_UNDEFINED_REASON
}

type GetLoggingEndpointResponse struct {
	Status               Status                            `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               GetLoggingEndpointResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.GetLoggingEndpointResponse_Reason" json:"reason,omitempty"`
	LoggingEndpoint      string                            `protobuf:"bytes,3,opt,name=logging_endpoint,json=loggingEndpoint,proto3" json:"logging_endpoint,omitempty"`
	LoggingProtocol      string                            `protobuf:"bytes,4,opt,name=logging_protocol,json=loggingProtocol,proto3" json:"logging_protocol,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                          `json:"-"`
	XXX_unrecognized     []byte                            `json:"-"`
	XXX_sizecache        int32                             `json:"-"`
}

func (m *GetLoggingEndpointResponse) Reset()         { *m = GetLoggingEndpointResponse{} }
func (m *GetLoggingEndpointResponse) String() string { return proto.CompactTextString(m) }
func (*GetLoggingEndpointResponse) ProtoMessage()    {}
func (*GetLoggingEndpointResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{12}
}

func (m *GetLoggingEndpointResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_GetLoggingEndpointResponse.Unmarshal(m, b)
}
func (m *GetLoggingEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_GetLoggingEndpointResponse.Marshal(b, m, deterministic)
}
func (m *GetLoggingEndpointResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_GetLoggingEndpointResponse.Merge(m, src)
}
func (m *GetLoggingEndpointResponse) XXX_Size() int {
	return xxx_messageInfo_GetLoggingEndpointResponse.Size(m)
}
func (m *GetLoggingEndpointResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_GetLoggingEndpointResponse.DiscardUnknown(m)
}

var xxx_messageInfo_GetLoggingEndpointResponse proto.InternalMessageInfo

func (m *GetLoggingEndpointResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *GetLoggingEndpointResponse) GetReason() GetLoggingEndpointResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return GetLoggingEndpointResponse_UNDEFINED_REASON
}

func (m *GetLoggingEndpointResponse) GetLoggingEndpoint() string {
	if m != nil {
		return m.LoggingEndpoint
	}
	return ""
}

func (m *GetLoggingEndpointResponse) GetLoggingProtocol() string {
	if m != nil {
		return m.LoggingProtocol
	}
	return ""
}

type SetMsgBusEndpointRequest struct {
	MsgbusEndpoint       string   `protobuf:"bytes,1,opt,name=msgbus_endpoint,json=msgbusEndpoint,proto3" json:"msgbus_endpoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *SetMsgBusEndpointRequest) Reset()         { *m = SetMsgBusEndpointRequest{} }
func (m *SetMsgBusEndpointRequest) String() string { return proto.CompactTextString(m) }
func (*SetMsgBusEndpointRequest) ProtoMessage()    {}
func (*SetMsgBusEndpointRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{13}
}

func (m *SetMsgBusEndpointRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SetMsgBusEndpointRequest.Unmarshal(m, b)
}
func (m *SetMsgBusEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SetMsgBusEndpointRequest.Marshal(b, m, deterministic)
}
func (m *SetMsgBusEndpointRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SetMsgBusEndpointRequest.Merge(m, src)
}
func (m *SetMsgBusEndpointRequest) XXX_Size() int {
	return xxx_messageInfo_SetMsgBusEndpointRequest.Size(m)
}
func (m *SetMsgBusEndpointRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_SetMsgBusEndpointRequest.DiscardUnknown(m)
}

var xxx_messageInfo_SetMsgBusEndpointRequest proto.InternalMessageInfo

func (m *SetMsgBusEndpointRequest) GetMsgbusEndpoint() string {
	if m != nil {
		return m.MsgbusEndpoint
	}
	return ""
}

type GetMsgBusEndpointResponse struct {
	Status               Status                           `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               GetMsgBusEndpointResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.GetMsgBusEndpointResponse_Reason" json:"reason,omitempty"`
	MsgbusEndpoint       string                           `protobuf:"bytes,3,opt,name=msgbus_endpoint,json=msgbusEndpoint,proto3" json:"msgbus_endpoint,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                         `json:"-"`
	XXX_unrecognized     []byte                           `json:"-"`
	XXX_sizecache        int32                            `json:"-"`
}

func (m *GetMsgBusEndpointResponse) Reset()         { *m = GetMsgBusEndpointResponse{} }
func (m *GetMsgBusEndpointResponse) String() string { return proto.CompactTextString(m) }
func (*GetMsgBusEndpointResponse) ProtoMessage()    {}
func (*GetMsgBusEndpointResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{14}
}

func (m *GetMsgBusEndpointResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_GetMsgBusEndpointResponse.Unmarshal(m, b)
}
func (m *GetMsgBusEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_GetMsgBusEndpointResponse.Marshal(b, m, deterministic)
}
func (m *GetMsgBusEndpointResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_GetMsgBusEndpointResponse.Merge(m, src)
}
func (m *GetMsgBusEndpointResponse) XXX_Size() int {
	return xxx_messageInfo_GetMsgBusEndpointResponse.Size(m)
}
func (m *GetMsgBusEndpointResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_GetMsgBusEndpointResponse.DiscardUnknown(m)
}

var xxx_messageInfo_GetMsgBusEndpointResponse proto.InternalMessageInfo

func (m *GetMsgBusEndpointResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *GetMsgBusEndpointResponse) GetReason() GetMsgBusEndpointResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return GetMsgBusEndpointResponse_UNDEFINED_REASON
}

func (m *GetMsgBusEndpointResponse) GetMsgbusEndpoint() string {
	if m != nil {
		return m.MsgbusEndpoint
	}
	return ""
}

type EntitiesLogLevel struct {
	LogLevel             LogLevel `protobuf:"varint,1,opt,name=logLevel,proto3,enum=dmi.LogLevel" json:"logLevel,omitempty"`
	Entities             []string `protobuf:"bytes,2,rep,name=entities,proto3" json:"entities,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *EntitiesLogLevel) Reset()         { *m = EntitiesLogLevel{} }
func (m *EntitiesLogLevel) String() string { return proto.CompactTextString(m) }
func (*EntitiesLogLevel) ProtoMessage()    {}
func (*EntitiesLogLevel) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{15}
}

func (m *EntitiesLogLevel) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_EntitiesLogLevel.Unmarshal(m, b)
}
func (m *EntitiesLogLevel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_EntitiesLogLevel.Marshal(b, m, deterministic)
}
func (m *EntitiesLogLevel) XXX_Merge(src proto.Message) {
	xxx_messageInfo_EntitiesLogLevel.Merge(m, src)
}
func (m *EntitiesLogLevel) XXX_Size() int {
	return xxx_messageInfo_EntitiesLogLevel.Size(m)
}
func (m *EntitiesLogLevel) XXX_DiscardUnknown() {
	xxx_messageInfo_EntitiesLogLevel.DiscardUnknown(m)
}

var xxx_messageInfo_EntitiesLogLevel proto.InternalMessageInfo

func (m *EntitiesLogLevel) GetLogLevel() LogLevel {
	if m != nil {
		return m.LogLevel
	}
	return LogLevel_TRACE
}

func (m *EntitiesLogLevel) GetEntities() []string {
	if m != nil {
		return m.Entities
	}
	return nil
}

type SetLogLevelRequest struct {
	DeviceUuid           *Uuid               `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	Loglevels            []*EntitiesLogLevel `protobuf:"bytes,2,rep,name=loglevels,proto3" json:"loglevels,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func (m *SetLogLevelRequest) Reset()         { *m = SetLogLevelRequest{} }
func (m *SetLogLevelRequest) String() string { return proto.CompactTextString(m) }
func (*SetLogLevelRequest) ProtoMessage()    {}
func (*SetLogLevelRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{16}
}

func (m *SetLogLevelRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SetLogLevelRequest.Unmarshal(m, b)
}
func (m *SetLogLevelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SetLogLevelRequest.Marshal(b, m, deterministic)
}
func (m *SetLogLevelRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SetLogLevelRequest.Merge(m, src)
}
func (m *SetLogLevelRequest) XXX_Size() int {
	return xxx_messageInfo_SetLogLevelRequest.Size(m)
}
func (m *SetLogLevelRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_SetLogLevelRequest.DiscardUnknown(m)
}

var xxx_messageInfo_SetLogLevelRequest proto.InternalMessageInfo

func (m *SetLogLevelRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *SetLogLevelRequest) GetLoglevels() []*EntitiesLogLevel {
	if m != nil {
		return m.Loglevels
	}
	return nil
}

type SetLogLevelResponse struct {
	DeviceUuid           *Uuid                      `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	Status               Status                     `protobuf:"varint,2,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               SetLogLevelResponse_Reason `protobuf:"varint,3,opt,name=reason,proto3,enum=dmi.SetLogLevelResponse_Reason" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

func (m *SetLogLevelResponse) Reset()         { *m = SetLogLevelResponse{} }
func (m *SetLogLevelResponse) String() string { return proto.CompactTextString(m) }
func (*SetLogLevelResponse) ProtoMessage()    {}
func (*SetLogLevelResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{17}
}

func (m *SetLogLevelResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SetLogLevelResponse.Unmarshal(m, b)
}
func (m *SetLogLevelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SetLogLevelResponse.Marshal(b, m, deterministic)
}
func (m *SetLogLevelResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SetLogLevelResponse.Merge(m, src)
}
func (m *SetLogLevelResponse) XXX_Size() int {
	return xxx_messageInfo_SetLogLevelResponse.Size(m)
}
func (m *SetLogLevelResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_SetLogLevelResponse.DiscardUnknown(m)
}

var xxx_messageInfo_SetLogLevelResponse proto.InternalMessageInfo

func (m *SetLogLevelResponse) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *SetLogLevelResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *SetLogLevelResponse) GetReason() SetLogLevelResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return SetLogLevelResponse_UNDEFINED_REASON
}

type GetLogLevelRequest struct {
	DeviceUuid           *Uuid    `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	Entities             []string `protobuf:"bytes,2,rep,name=entities,proto3" json:"entities,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *GetLogLevelRequest) Reset()         { *m = GetLogLevelRequest{} }
func (m *GetLogLevelRequest) String() string { return proto.CompactTextString(m) }
func (*GetLogLevelRequest) ProtoMessage()    {}
func (*GetLogLevelRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{18}
}

func (m *GetLogLevelRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_GetLogLevelRequest.Unmarshal(m, b)
}
func (m *GetLogLevelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_GetLogLevelRequest.Marshal(b, m, deterministic)
}
func (m *GetLogLevelRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_GetLogLevelRequest.Merge(m, src)
}
func (m *GetLogLevelRequest) XXX_Size() int {
	return xxx_messageInfo_GetLogLevelRequest.Size(m)
}
func (m *GetLogLevelRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_GetLogLevelRequest.DiscardUnknown(m)
}

var xxx_messageInfo_GetLogLevelRequest proto.InternalMessageInfo

func (m *GetLogLevelRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *GetLogLevelRequest) GetEntities() []string {
	if m != nil {
		return m.Entities
	}
	return nil
}

type GetLogLevelResponse struct {
	DeviceUuid           *Uuid                      `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	LogLevels            []*EntitiesLogLevel        `protobuf:"bytes,2,rep,name=logLevels,proto3" json:"logLevels,omitempty"`
	Status               Status                     `protobuf:"varint,3,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               GetLogLevelResponse_Reason `protobuf:"varint,4,opt,name=reason,proto3,enum=dmi.GetLogLevelResponse_Reason" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

func (m *GetLogLevelResponse) Reset()         { *m = GetLogLevelResponse{} }
func (m *GetLogLevelResponse) String() string { return proto.CompactTextString(m) }
func (*GetLogLevelResponse) ProtoMessage()    {}
func (*GetLogLevelResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{19}
}

func (m *GetLogLevelResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_GetLogLevelResponse.Unmarshal(m, b)
}
func (m *GetLogLevelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_GetLogLevelResponse.Marshal(b, m, deterministic)
}
func (m *GetLogLevelResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_GetLogLevelResponse.Merge(m, src)
}
func (m *GetLogLevelResponse) XXX_Size() int {
	return xxx_messageInfo_GetLogLevelResponse.Size(m)
}
func (m *GetLogLevelResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_GetLogLevelResponse.DiscardUnknown(m)
}

var xxx_messageInfo_GetLogLevelResponse proto.InternalMessageInfo

func (m *GetLogLevelResponse) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func (m *GetLogLevelResponse) GetLogLevels() []*EntitiesLogLevel {
	if m != nil {
		return m.LogLevels
	}
	return nil
}

func (m *GetLogLevelResponse) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *GetLogLevelResponse) GetReason() GetLogLevelResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return GetLogLevelResponse_UNDEFINED_REASON
}

type GetLoggableEntitiesRequest struct {
	DeviceUuid           *Uuid    `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *GetLoggableEntitiesRequest) Reset()         { *m = GetLoggableEntitiesRequest{} }
func (m *GetLoggableEntitiesRequest) String() string { return proto.CompactTextString(m) }
func (*GetLoggableEntitiesRequest) ProtoMessage()    {}
func (*GetLoggableEntitiesRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{20}
}

func (m *GetLoggableEntitiesRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_GetLoggableEntitiesRequest.Unmarshal(m, b)
}
func (m *GetLoggableEntitiesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_GetLoggableEntitiesRequest.Marshal(b, m, deterministic)
}
func (m *GetLoggableEntitiesRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_GetLoggableEntitiesRequest.Merge(m, src)
}
func (m *GetLoggableEntitiesRequest) XXX_Size() int {
	return xxx_messageInfo_GetLoggableEntitiesRequest.Size(m)
}
func (m *GetLoggableEntitiesRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_GetLoggableEntitiesRequest.DiscardUnknown(m)
}

var xxx_messageInfo_GetLoggableEntitiesRequest proto.InternalMessageInfo

func (m *GetLoggableEntitiesRequest) GetDeviceUuid() *Uuid {
	if m != nil {
		return m.DeviceUuid
	}
	return nil
}

func init() {
	proto.RegisterEnum("dmi.PhysicalInventoryResponse_Reason", PhysicalInventoryResponse_Reason_name, PhysicalInventoryResponse_Reason_value)
	proto.RegisterEnum("dmi.HWComponentInfoGetResponse_Reason", HWComponentInfoGetResponse_Reason_name, HWComponentInfoGetResponse_Reason_value)
	proto.RegisterEnum("dmi.HWComponentInfoSetResponse_Reason", HWComponentInfoSetResponse_Reason_name, HWComponentInfoSetResponse_Reason_value)
	proto.RegisterEnum("dmi.StartManagingDeviceResponse_Reason", StartManagingDeviceResponse_Reason_name, StartManagingDeviceResponse_Reason_value)
	proto.RegisterEnum("dmi.StopManagingDeviceResponse_Reason", StopManagingDeviceResponse_Reason_name, StopManagingDeviceResponse_Reason_value)
	proto.RegisterEnum("dmi.SetRemoteEndpointResponse_Reason", SetRemoteEndpointResponse_Reason_name, SetRemoteEndpointResponse_Reason_value)
	proto.RegisterEnum("dmi.GetLoggingEndpointResponse_Reason", GetLoggingEndpointResponse_Reason_name, GetLoggingEndpointResponse_Reason_value)
	proto.RegisterEnum("dmi.GetMsgBusEndpointResponse_Reason", GetMsgBusEndpointResponse_Reason_name, GetMsgBusEndpointResponse_Reason_value)
	proto.RegisterEnum("dmi.SetLogLevelResponse_Reason", SetLogLevelResponse_Reason_name, SetLogLevelResponse_Reason_value)
	proto.RegisterEnum("dmi.GetLogLevelResponse_Reason", GetLogLevelResponse_Reason_name, GetLogLevelResponse_Reason_value)
	proto.RegisterType((*PhysicalInventoryRequest)(nil), "dmi.PhysicalInventoryRequest")
	proto.RegisterType((*PhysicalInventoryResponse)(nil), "dmi.PhysicalInventoryResponse")
	proto.RegisterType((*HWComponentInfoGetRequest)(nil), "dmi.HWComponentInfoGetRequest")
	proto.RegisterType((*HWComponentInfoGetResponse)(nil), "dmi.HWComponentInfoGetResponse")
	proto.RegisterType((*HWComponentInfoSetRequest)(nil), "dmi.HWComponentInfoSetRequest")
	proto.RegisterType((*HWComponentInfoSetResponse)(nil), "dmi.HWComponentInfoSetResponse")
	proto.RegisterType((*StartManagingDeviceResponse)(nil), "dmi.StartManagingDeviceResponse")
	proto.RegisterType((*StopManagingDeviceRequest)(nil), "dmi.StopManagingDeviceRequest")
	proto.RegisterType((*StopManagingDeviceResponse)(nil), "dmi.StopManagingDeviceResponse")
	proto.RegisterType((*ManagedDevicesResponse)(nil), "dmi.ManagedDevicesResponse")
	proto.RegisterType((*SetLoggingEndpointRequest)(nil), "dmi.SetLoggingEndpointRequest")
	proto.RegisterType((*SetRemoteEndpointResponse)(nil), "dmi.SetRemoteEndpointResponse")
	proto.RegisterType((*GetLoggingEndpointResponse)(nil), "dmi.GetLoggingEndpointResponse")
	proto.RegisterType((*SetMsgBusEndpointRequest)(nil), "dmi.SetMsgBusEndpointRequest")
	proto.RegisterType((*GetMsgBusEndpointResponse)(nil), "dmi.GetMsgBusEndpointResponse")
	proto.RegisterType((*EntitiesLogLevel)(nil), "dmi.EntitiesLogLevel")
	proto.RegisterType((*SetLogLevelRequest)(nil), "dmi.SetLogLevelRequest")
	proto.RegisterType((*SetLogLevelResponse)(nil), "dmi.SetLogLevelResponse")
	proto.RegisterType((*GetLogLevelRequest)(nil), "dmi.GetLogLevelRequest")
	proto.RegisterType((*GetLogLevelResponse)(nil), "dmi.GetLogLevelResponse")
	proto.RegisterType((*GetLoggableEntitiesRequest)(nil), "dmi.GetLoggableEntitiesRequest")
}

func init() { proto.RegisterFile("dmi/hw_management_service.proto", fileDescriptor_eae902e73066286d) }

var fileDescriptor_eae902e73066286d = []byte{
	// 1332 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6e, 0xdb, 0x46,
	0x17, 0xfd, 0x48, 0x39, 0x4e, 0x74, 0xfd, 0xc5, 0x91, 0x27, 0x89, 0x2b, 0x31, 0x88, 0x9d, 0x32,
	0x48, 0x93, 0xb4, 0x8d, 0x14, 0x28, 0x8b, 0xa2, 0x28, 0xfa, 0x23, 0x5b, 0x0c, 0xcd, 0x46, 0x22,
	0x85, 0xa1, 0x1c, 0x23, 0x45, 0x51, 0x82, 0x16, 0xc7, 0x32, 0x01, 0x91, 0x54, 0x45, 0x4a, 0x81,
	0x1f, 0xa0, 0x8b, 0x02, 0xed, 0xba, 0xab, 0x02, 0x5d, 0x75, 0xdb, 0x55, 0x51, 0xa0, 0xe8, 0x23,
	0x74, 0xd9, 0x47, 0xe9, 0x03, 0x14, 0x9c, 0x21, 0xf5, 0x43, 0x91, 0x92, 0xff, 0x02, 0x64, 0x27,
	0x71, 0xce, 0x1c, 0xde, 0xb9, 0xe7, 0xce, 0x99, 0xcb, 0x81, 0x6d, 0xcb, 0xb1, 0x2b, 0xc7, 0xaf,
	0x0d, 0xc7, 0x74, 0xcd, 0x2e, 0x71, 0x88, 0x1b, 0x18, 0x3e, 0x19, 0x8c, 0xec, 0x0e, 0x29, 0xf7,
	0x07, 0x5e, 0xe0, 0xa1, 0x9c, 0xe5, 0xd8, 0xc2, 0x46, 0x88, 0xea, 0x78, 0x8e, 0xe3, 0xb9, 0x3e,
	0x7b, 0x2e, 0xfc, 0x9f, 0x4d, 0x8c, 0xfe, 0xdd, 0xe9, 0x7a, 0x5e, 0xb7, 0x47, 0x2a, 0xf4, 0xdf,
	0xe1, 0xf0, 0xa8, 0x42, 0x9c, 0x7e, 0x70, 0xc2, 0x06, 0xc5, 0xe7, 0x50, 0x6c, 0x1d, 0x9f, 0xf8,
	0x76, 0xc7, 0xec, 0x29, 0xee, 0x88, 0xb8, 0x81, 0x37, 0x38, 0xc1, 0xe4, 0xdb, 0x21, 0xf1, 0x03,
	0xf4, 0x3e, 0xac, 0x59, 0x24, 0x7c, 0x9d, 0x31, 0x1c, 0xda, 0x56, 0x91, 0xbb, 0xc7, 0x3d, 0x5a,
	0xab, 0xe6, 0xcb, 0x96, 0x63, 0x97, 0xf7, 0x87, 0xb6, 0x85, 0x81, 0x8d, 0x86, 0xbf, 0xc5, 0x1f,
	0x78, 0x28, 0xa5, 0x10, 0xf9, 0x7d, 0xcf, 0xf5, 0x09, 0xba, 0x0f, 0xab, 0x7e, 0x60, 0x06, 0x43,
	0x9f, 0x92, 0xac, 0x57, 0xd7, 0x28, 0x89, 0x4e, 0x1f, 0xe1, 0x68, 0x08, 0x7d, 0x0a, 0xab, 0x03,
	0x62, 0xfa, 0x9e, 0x5b, 0xe4, 0x29, 0xe8, 0x01, 0x05, 0x65, 0x92, 0x96, 0x31, 0x05, 0xe3, 0x68,
	0x12, 0xfa, 0x00, 0xf2, 0x76, 0x8c, 0x29, 0xe6, 0x68, 0xac, 0xd7, 0x29, 0xc3, 0x9e, 0x39, 0xb0,
	0x5e, 0x9b, 0x03, 0x82, 0x27, 0xe3, 0xe2, 0x37, 0xb0, 0xca, 0xa6, 0xa3, 0x5b, 0x50, 0xd8, 0x57,
	0xeb, 0xd2, 0x73, 0x45, 0x95, 0xea, 0x06, 0x96, 0x6a, 0xba, 0xa6, 0x16, 0xfe, 0x87, 0x10, 0xac,
	0xef, 0xab, 0x2f, 0x54, 0xed, 0x40, 0x35, 0xea, 0xd2, 0x4b, 0x65, 0x57, 0x2a, 0x70, 0xe1, 0x33,
	0x45, 0x6d, 0x4b, 0x58, 0xad, 0x35, 0x0c, 0x09, 0x63, 0x0d, 0x17, 0x78, 0xb4, 0x09, 0x88, 0x8d,
	0x1b, 0xfb, 0x2a, 0x96, 0x6a, 0xbb, 0x7b, 0xb5, 0x9d, 0x86, 0x54, 0xc8, 0x89, 0xbf, 0x70, 0x50,
	0xda, 0x3b, 0xd8, 0xf5, 0x9c, 0xbe, 0xe7, 0x12, 0x37, 0x50, 0xdc, 0x23, 0x4f, 0x26, 0xc1, 0x39,
	0x12, 0x8b, 0x9e, 0xc2, 0x7a, 0x27, 0xa6, 0x61, 0x70, 0x3e, 0x09, 0xbf, 0x3e, 0x06, 0xd0, 0x19,
	0x0f, 0xa6, 0x67, 0xb8, 0xa6, 0x43, 0x68, 0x36, 0xf2, 0x53, 0x30, 0xd5, 0x74, 0x88, 0xf8, 0x2b,
	0x0f, 0x42, 0x5a, 0x88, 0x67, 0x91, 0xec, 0xb3, 0x84, 0x64, 0xef, 0xb1, 0x84, 0x67, 0xb2, 0x26,
	0x35, 0xfb, 0x10, 0xf2, 0xe3, 0xa0, 0x22, 0xcd, 0xd6, 0x29, 0xc5, 0x98, 0x00, 0x4f, 0x00, 0xe2,
	0xf0, 0x1c, 0xa2, 0xdd, 0x86, 0x8d, 0xf8, 0xd9, 0xae, 0xd6, 0x6c, 0x69, 0xaa, 0xa4, 0xb6, 0x0b,
	0x7c, 0x8a, 0x96, 0xb9, 0x0c, 0x2d, 0x57, 0xc4, 0x7f, 0xe6, 0xb5, 0xd4, 0xdf, 0x2e, 0x2d, 0x51,
	0x15, 0xae, 0x76, 0x8e, 0x4d, 0xb7, 0x4b, 0xfc, 0xe2, 0x0a, 0x65, 0x2c, 0x52, 0xc6, 0xa6, 0x67,
	0xd9, 0x47, 0xb6, 0x79, 0xd8, 0x23, 0x93, 0x7c, 0xc6, 0x40, 0xf1, 0xc7, 0x79, 0xfd, 0xf5, 0x37,
	0xa2, 0xbf, 0x9e, 0xa9, 0xbf, 0xf8, 0x3d, 0x77, 0xc9, 0x92, 0xbe, 0xac, 0x35, 0x94, 0xba, 0xd1,
	0xaa, 0xe1, 0x5a, 0x53, 0x2f, 0xe4, 0x52, 0x64, 0x5e, 0xc9, 0x90, 0xf9, 0x8a, 0xf8, 0x07, 0x0f,
	0x77, 0xf4, 0xc0, 0x1c, 0x04, 0xcd, 0xd0, 0x6e, 0x6d, 0xb7, 0x5b, 0xa7, 0xc2, 0x9d, 0x2d, 0x21,
	0x9f, 0x27, 0x12, 0xf2, 0x30, 0x06, 0x65, 0xd1, 0x26, 0x77, 0x44, 0xa2, 0x9c, 0x72, 0x8b, 0x3c,
	0xf7, 0xbb, 0x65, 0xd9, 0x13, 0x60, 0x33, 0x5a, 0x6a, 0xad, 0x81, 0xa5, 0x5a, 0xfd, 0x95, 0xd1,
	0xac, 0xa9, 0x35, 0x59, 0xaa, 0x17, 0x38, 0xf4, 0x2e, 0xdc, 0xd5, 0x5a, 0x12, 0xae, 0xb5, 0x15,
	0x4d, 0x1d, 0x0f, 0x2b, 0xaa, 0xd1, 0xc2, 0x9a, 0x8c, 0x25, 0x5d, 0x3f, 0x7d, 0x46, 0xc5, 0x0a,
	0x94, 0xf4, 0xc0, 0xeb, 0x27, 0x17, 0xc8, 0xf6, 0x07, 0x82, 0x15, 0x5a, 0xb7, 0x1c, 0xad, 0x5b,
	0xfa, 0x5b, 0xfc, 0x9d, 0x03, 0x21, 0x6d, 0xc6, 0xc5, 0x4b, 0x2f, 0x9b, 0x35, 0x59, 0x7a, 0xd5,
	0xb3, 0x57, 0x9e, 0xd8, 0x80, 0x4d, 0x4a, 0x4e, 0x2c, 0xc6, 0xed, 0x8f, 0x43, 0xae, 0xc2, 0x55,
	0x26, 0x4c, 0x18, 0x73, 0x6e, 0xf1, 0x06, 0x8c, 0x80, 0xe2, 0xcf, 0x1c, 0x94, 0x74, 0x12, 0x34,
	0xbc, 0x6e, 0x18, 0xad, 0xe4, 0x5a, 0x7d, 0xcf, 0x76, 0xcf, 0xe5, 0x2b, 0x8f, 0xa1, 0xd0, 0x63,
	0x2c, 0x06, 0x89, 0x68, 0x68, 0x56, 0xf2, 0xf8, 0x46, 0x6f, 0x96, 0x7d, 0x1a, 0x4a, 0x1b, 0x80,
	0x8e, 0xd7, 0x8b, 0x2c, 0x25, 0x86, 0xb6, 0xa2, 0xc7, 0xe2, 0x5f, 0x3c, 0x8d, 0x0f, 0x13, 0xc7,
	0x0b, 0xc8, 0x24, 0xbc, 0x8b, 0x1f, 0xe9, 0x99, 0xa4, 0x49, 0x8d, 0xfe, 0xe4, 0x2e, 0xe9, 0x98,
	0x16, 0x60, 0xb3, 0xa1, 0xc9, 0xb2, 0xa2, 0xca, 0x86, 0xa4, 0xd6, 0x5b, 0x9a, 0xa2, 0xb6, 0xc7,
	0xb6, 0x7f, 0x1f, 0xb6, 0xe7, 0xc6, 0x5a, 0x58, 0x6b, 0x6b, 0xbb, 0xda, 0xc4, 0x34, 0x4a, 0x70,
	0xbb, 0xa9, 0xcb, 0x3b, 0xfb, 0x7a, 0x72, 0xfe, 0x95, 0x0c, 0x3f, 0x59, 0x0d, 0xfd, 0x44, 0x90,
	0x53, 0xe4, 0xbd, 0x78, 0x91, 0x67, 0xb3, 0x26, 0xdd, 0x24, 0xad, 0x30, 0x72, 0xa7, 0x2f, 0x8c,
	0x95, 0xf4, 0xc2, 0x78, 0xd3, 0xcd, 0xd3, 0x2e, 0x14, 0x75, 0x12, 0x34, 0xfd, 0xee, 0xce, 0xd0,
	0x4f, 0x6e, 0x8b, 0x87, 0x70, 0xc3, 0xf1, 0xbb, 0x87, 0x43, 0x7f, 0xb2, 0x20, 0xe6, 0x2c, 0xeb,
	0xec, 0x71, 0x8c, 0x17, 0xff, 0xe5, 0xa0, 0x24, 0xcf, 0xb3, 0x5c, 0xbc, 0x7a, 0x33, 0x49, 0x93,
	0xc9, 0x4f, 0x09, 0x35, 0x97, 0x1a, 0xea, 0x97, 0xcb, 0xf3, 0x99, 0xc8, 0x1d, 0x97, 0x91, 0x3b,
	0x5e, 0x7c, 0x05, 0x05, 0xc9, 0x0d, 0xec, 0xc0, 0x26, 0x7e, 0xc3, 0xeb, 0x36, 0xc8, 0x88, 0xf4,
	0xd0, 0x63, 0xb8, 0xd6, 0x8b, 0x7e, 0x47, 0xcb, 0x65, 0x8d, 0x71, 0x0c, 0xc0, 0xe3, 0x61, 0x24,
	0xc0, 0x35, 0x12, 0x4d, 0x2f, 0xf2, 0xf7, 0x72, 0x8f, 0xf2, 0x78, 0xfc, 0x5f, 0x1c, 0x02, 0x62,
	0x76, 0xc5, 0x26, 0x9d, 0xc3, 0xa7, 0x9e, 0x41, 0xbe, 0x17, 0x7e, 0x8a, 0x8c, 0x48, 0x8f, 0xd1,
	0xaf, 0x55, 0x6f, 0x53, 0x64, 0x32, 0x64, 0x3c, 0xc1, 0x89, 0x3f, 0xf1, 0x70, 0x73, 0xe6, 0xbd,
	0x91, 0x84, 0x67, 0x79, 0xf1, 0x44, 0x6e, 0x3e, 0x5b, 0xee, 0x8f, 0xc6, 0x72, 0xe7, 0x28, 0x68,
	0x3b, 0x36, 0xab, 0xe4, 0xab, 0x93, 0x36, 0x35, 0xba, 0xbc, 0xfd, 0x10, 0xe3, 0x1a, 0x5a, 0xe8,
	0x46, 0x6d, 0xa5, 0xfd, 0x6a, 0x41, 0x63, 0xfa, 0x35, 0x20, 0xf9, 0x62, 0x82, 0x2c, 0x92, 0xfb,
	0x6f, 0x1e, 0x6e, 0xca, 0x17, 0xcc, 0x3b, 0x13, 0xbc, 0x71, 0x4a, 0xc1, 0x19, 0x6e, 0x4a, 0xac,
	0xdc, 0x69, 0xc4, 0x5a, 0x99, 0x12, 0x4b, 0x7e, 0x7b, 0xc5, 0xda, 0x1b, 0x9f, 0x06, 0x61, 0x3b,
	0x10, 0xaf, 0xff, 0x1c, 0xa2, 0x55, 0x7f, 0xbb, 0x06, 0x25, 0xd5, 0x0c, 0xec, 0x11, 0xd9, 0x3b,
	0x68, 0x8e, 0xaf, 0x06, 0x74, 0x76, 0x33, 0x80, 0x74, 0xb8, 0x99, 0xd2, 0x6e, 0xa2, 0xcc, 0x7e,
	0x44, 0xb8, 0xb7, 0xac, 0x45, 0x7d, 0xca, 0xa1, 0x7d, 0x40, 0xf3, 0x9d, 0x15, 0xda, 0xca, 0x6c,
	0xb9, 0xe8, 0xa2, 0x84, 0xed, 0x25, 0x2d, 0x19, 0xda, 0x83, 0x8d, 0xd0, 0x4d, 0x67, 0x5a, 0x2a,
	0xb4, 0x59, 0x66, 0xf7, 0x15, 0xe5, 0xf8, 0xbe, 0xa2, 0x2c, 0x39, 0xfd, 0xe0, 0x44, 0xb8, 0xc3,
	0x56, 0x90, 0xde, 0x7f, 0x1d, 0xc0, 0x2d, 0x99, 0x04, 0x73, 0x77, 0x05, 0xe8, 0x6e, 0xd6, 0x1d,
	0x02, 0x8b, 0x70, 0x6b, 0xf1, 0x15, 0xc3, 0x53, 0x0e, 0x1d, 0xd0, 0x3d, 0x96, 0xf8, 0xa2, 0x89,
	0x56, 0x9e, 0xf9, 0x81, 0x1f, 0xad, 0x3c, 0xfb, 0x3b, 0x38, 0x4a, 0xe9, 0x29, 0x89, 0xf5, 0x25,
	0xc4, 0xd3, 0x9f, 0x6d, 0xed, 0xd8, 0xa4, 0x67, 0x0e, 0xf7, 0xad, 0x29, 0x2b, 0x4b, 0x69, 0x36,
	0x85, 0xad, 0xc5, 0x7d, 0x19, 0x7a, 0x1e, 0x3b, 0xcd, 0x0c, 0xeb, 0x8d, 0x99, 0xeb, 0x15, 0xa5,
	0x2e, 0x6c, 0x2f, 0x69, 0x4f, 0x10, 0x86, 0x8d, 0xb9, 0x93, 0x3d, 0xd2, 0x28, 0xeb, 0xc4, 0x5f,
	0x1a, 0xdb, 0x0b, 0x56, 0x44, 0xb3, 0x9c, 0x59, 0x45, 0xb4, 0xb5, 0xf8, 0x08, 0x47, 0xad, 0xd8,
	0xf3, 0x66, 0x76, 0x29, 0x9a, 0x59, 0x58, 0xca, 0xfe, 0x15, 0x8a, 0x59, 0xf6, 0x83, 0xbe, 0x80,
	0xb5, 0xa9, 0x23, 0x04, 0xbd, 0x33, 0x7f, 0xa8, 0x4c, 0x33, 0xe8, 0xe9, 0x0c, 0xf2, 0x1c, 0x83,
	0x9c, 0xc5, 0x90, 0x12, 0xc3, 0xce, 0x27, 0x5f, 0x7d, 0xdc, 0xb5, 0x83, 0xe3, 0xe1, 0x61, 0xb9,
	0xe3, 0x39, 0x15, 0xaf, 0x4f, 0xdc, 0x8e, 0x37, 0xb0, 0x2a, 0xcc, 0x53, 0x9e, 0x4c, 0xae, 0x17,
	0x9f, 0xd8, 0x6e, 0x40, 0x06, 0x47, 0x66, 0x87, 0x54, 0x46, 0xcf, 0x2a, 0x5d, 0xaf, 0x62, 0x39,
	0xf6, 0xe1, 0x2a, 0x4d, 0xe1, 0xb3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x09, 0xbd, 0x17,
	0x8e, 0x14, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// NativeHWManagementServiceClient is the client API for NativeHWManagementService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type NativeHWManagementServiceClient interface {
	// Initializes context for a device and sets up required states
	// In the call to StartManagingDevice, the fields of ModifiableComponent which are relevant
	// and their meanings in this context is mentioned below:
	// name = The unique name that needs to be assigned to this hardware;
	// class = COMPONENT_TYPE_UNDEFINED;
	// parent = nil;
	// alias = Optional;
	// asset_id = Optional;
	// uri = IP Address of the Hardware;
	StartManagingDevice(ctx context.Context, in *ModifiableComponent, opts ...grpc.CallOption) (NativeHWManagementService_StartManagingDeviceClient, error)
	// Stop management of a device and clean up any context and caches for that device
	// This rpc can be called at any time, even before the StartManagingDevice operation
	// has completed, and should be able to cleanup.
	StopManagingDevice(ctx context.Context, in *StopManagingDeviceRequest, opts ...grpc.CallOption) (*StopManagingDeviceResponse, error)
	// Returns an object containing a list of devices managed by this entity
	GetManagedDevices(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ManagedDevicesResponse, error)
	// Get the HW inventory details of the Device
	GetPhysicalInventory(ctx context.Context, in *PhysicalInventoryRequest, opts ...grpc.CallOption) (NativeHWManagementService_GetPhysicalInventoryClient, error)
	// Get the details of a particular HW component
	GetHWComponentInfo(ctx context.Context, in *HWComponentInfoGetRequest, opts ...grpc.CallOption) (NativeHWManagementService_GetHWComponentInfoClient, error)
	// Sets the permissible attributes of a HW component
	SetHWComponentInfo(ctx context.Context, in *HWComponentInfoSetRequest, opts ...grpc.CallOption) (*HWComponentInfoSetResponse, error)
	// Sets the location to which logs need to be shipped
	SetLoggingEndpoint(ctx context.Context, in *SetLoggingEndpointRequest, opts ...grpc.CallOption) (*SetRemoteEndpointResponse, error)
	// Gets the configured location to which the logs are being shipped
	GetLoggingEndpoint(ctx context.Context, in *HardwareID, opts ...grpc.CallOption) (*GetLoggingEndpointResponse, error)
	// Sets the location of the Message Bus to which events and metrics are shipped
	SetMsgBusEndpoint(ctx context.Context, in *SetMsgBusEndpointRequest, opts ...grpc.CallOption) (*SetRemoteEndpointResponse, error)
	// Gets the configured location to which the events and metrics are being shipped
	GetMsgBusEndpoint(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*GetMsgBusEndpointResponse, error)
	// Gets the entities of a device on which log can be configured. A few are expected, like OS, PON Management etc.
	// In general an entity is any item within an hardware system that can emit logs, e.g. service, process, subsystem,
	// interface, package etc.
	GetLoggableEntities(ctx context.Context, in *GetLoggableEntitiesRequest, opts ...grpc.CallOption) (*GetLogLevelResponse, error)
	// Sets the log level of the device, for each given entity to a certain level.
	// If only one EntitiesLogLevel is provided for the device and that request contains only a log level with
	// no entity in the list it's assumed that the caller wants to set that level for all the entities.
	SetLogLevel(ctx context.Context, in *SetLogLevelRequest, opts ...grpc.CallOption) (*SetLogLevelResponse, error)
	// Gets the configured log level for a certain entity on a certain device.
	// If no entity is specified in the request all the entities with their log level should be returned.
	GetLogLevel(ctx context.Context, in *GetLogLevelRequest, opts ...grpc.CallOption) (*GetLogLevelResponse, error)
}

type nativeHWManagementServiceClient struct {
	cc *grpc.ClientConn
}

func NewNativeHWManagementServiceClient(cc *grpc.ClientConn) NativeHWManagementServiceClient {
	return &nativeHWManagementServiceClient{cc}
}

func (c *nativeHWManagementServiceClient) StartManagingDevice(ctx context.Context, in *ModifiableComponent, opts ...grpc.CallOption) (NativeHWManagementService_StartManagingDeviceClient, error) {
	stream, err := c.cc.NewStream(ctx, &_NativeHWManagementService_serviceDesc.Streams[0], "/dmi.NativeHWManagementService/StartManagingDevice", opts...)
	if err != nil {
		return nil, err
	}
	x := &nativeHWManagementServiceStartManagingDeviceClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type NativeHWManagementService_StartManagingDeviceClient interface {
	Recv() (*StartManagingDeviceResponse, error)
	grpc.ClientStream
}

type nativeHWManagementServiceStartManagingDeviceClient struct {
	grpc.ClientStream
}

func (x *nativeHWManagementServiceStartManagingDeviceClient) Recv() (*StartManagingDeviceResponse, error) {
	m := new(StartManagingDeviceResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *nativeHWManagementServiceClient) StopManagingDevice(ctx context.Context, in *StopManagingDeviceRequest, opts ...grpc.CallOption) (*StopManagingDeviceResponse, error) {
	out := new(StopManagingDeviceResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/StopManagingDevice", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetManagedDevices(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ManagedDevicesResponse, error) {
	out := new(ManagedDevicesResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/GetManagedDevices", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetPhysicalInventory(ctx context.Context, in *PhysicalInventoryRequest, opts ...grpc.CallOption) (NativeHWManagementService_GetPhysicalInventoryClient, error) {
	stream, err := c.cc.NewStream(ctx, &_NativeHWManagementService_serviceDesc.Streams[1], "/dmi.NativeHWManagementService/GetPhysicalInventory", opts...)
	if err != nil {
		return nil, err
	}
	x := &nativeHWManagementServiceGetPhysicalInventoryClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type NativeHWManagementService_GetPhysicalInventoryClient interface {
	Recv() (*PhysicalInventoryResponse, error)
	grpc.ClientStream
}

type nativeHWManagementServiceGetPhysicalInventoryClient struct {
	grpc.ClientStream
}

func (x *nativeHWManagementServiceGetPhysicalInventoryClient) Recv() (*PhysicalInventoryResponse, error) {
	m := new(PhysicalInventoryResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *nativeHWManagementServiceClient) GetHWComponentInfo(ctx context.Context, in *HWComponentInfoGetRequest, opts ...grpc.CallOption) (NativeHWManagementService_GetHWComponentInfoClient, error) {
	stream, err := c.cc.NewStream(ctx, &_NativeHWManagementService_serviceDesc.Streams[2], "/dmi.NativeHWManagementService/GetHWComponentInfo", opts...)
	if err != nil {
		return nil, err
	}
	x := &nativeHWManagementServiceGetHWComponentInfoClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type NativeHWManagementService_GetHWComponentInfoClient interface {
	Recv() (*HWComponentInfoGetResponse, error)
	grpc.ClientStream
}

type nativeHWManagementServiceGetHWComponentInfoClient struct {
	grpc.ClientStream
}

func (x *nativeHWManagementServiceGetHWComponentInfoClient) Recv() (*HWComponentInfoGetResponse, error) {
	m := new(HWComponentInfoGetResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *nativeHWManagementServiceClient) SetHWComponentInfo(ctx context.Context, in *HWComponentInfoSetRequest, opts ...grpc.CallOption) (*HWComponentInfoSetResponse, error) {
	out := new(HWComponentInfoSetResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/SetHWComponentInfo", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) SetLoggingEndpoint(ctx context.Context, in *SetLoggingEndpointRequest, opts ...grpc.CallOption) (*SetRemoteEndpointResponse, error) {
	out := new(SetRemoteEndpointResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/SetLoggingEndpoint", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetLoggingEndpoint(ctx context.Context, in *HardwareID, opts ...grpc.CallOption) (*GetLoggingEndpointResponse, error) {
	out := new(GetLoggingEndpointResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/GetLoggingEndpoint", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) SetMsgBusEndpoint(ctx context.Context, in *SetMsgBusEndpointRequest, opts ...grpc.CallOption) (*SetRemoteEndpointResponse, error) {
	out := new(SetRemoteEndpointResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/SetMsgBusEndpoint", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetMsgBusEndpoint(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*GetMsgBusEndpointResponse, error) {
	out := new(GetMsgBusEndpointResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/GetMsgBusEndpoint", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetLoggableEntities(ctx context.Context, in *GetLoggableEntitiesRequest, opts ...grpc.CallOption) (*GetLogLevelResponse, error) {
	out := new(GetLogLevelResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/GetLoggableEntities", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) SetLogLevel(ctx context.Context, in *SetLogLevelRequest, opts ...grpc.CallOption) (*SetLogLevelResponse, error) {
	out := new(SetLogLevelResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/SetLogLevel", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nativeHWManagementServiceClient) GetLogLevel(ctx context.Context, in *GetLogLevelRequest, opts ...grpc.CallOption) (*GetLogLevelResponse, error) {
	out := new(GetLogLevelResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/GetLogLevel", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// NativeHWManagementServiceServer is the server API for NativeHWManagementService service.
type NativeHWManagementServiceServer interface {
	// Initializes context for a device and sets up required states
	// In the call to StartManagingDevice, the fields of ModifiableComponent which are relevant
	// and their meanings in this context is mentioned below:
	// name = The unique name that needs to be assigned to this hardware;
	// class = COMPONENT_TYPE_UNDEFINED;
	// parent = nil;
	// alias = Optional;
	// asset_id = Optional;
	// uri = IP Address of the Hardware;
	StartManagingDevice(*ModifiableComponent, NativeHWManagementService_StartManagingDeviceServer) error
	// Stop management of a device and clean up any context and caches for that device
	// This rpc can be called at any time, even before the StartManagingDevice operation
	// has completed, and should be able to cleanup.
	StopManagingDevice(context.Context, *StopManagingDeviceRequest) (*StopManagingDeviceResponse, error)
	// Returns an object containing a list of devices managed by this entity
	GetManagedDevices(context.Context, *empty.Empty) (*ManagedDevicesResponse, error)
	// Get the HW inventory details of the Device
	GetPhysicalInventory(*PhysicalInventoryRequest, NativeHWManagementService_GetPhysicalInventoryServer) error
	// Get the details of a particular HW component
	GetHWComponentInfo(*HWComponentInfoGetRequest, NativeHWManagementService_GetHWComponentInfoServer) error
	// Sets the permissible attributes of a HW component
	SetHWComponentInfo(context.Context, *HWComponentInfoSetRequest) (*HWComponentInfoSetResponse, error)
	// Sets the location to which logs need to be shipped
	SetLoggingEndpoint(context.Context, *SetLoggingEndpointRequest) (*SetRemoteEndpointResponse, error)
	// Gets the configured location to which the logs are being shipped
	GetLoggingEndpoint(context.Context, *HardwareID) (*GetLoggingEndpointResponse, error)
	// Sets the location of the Message Bus to which events and metrics are shipped
	SetMsgBusEndpoint(context.Context, *SetMsgBusEndpointRequest) (*SetRemoteEndpointResponse, error)
	// Gets the configured location to which the events and metrics are being shipped
	GetMsgBusEndpoint(context.Context, *empty.Empty) (*GetMsgBusEndpointResponse, error)
	// Gets the entities of a device on which log can be configured. A few are expected, like OS, PON Management etc.
	// In general an entity is any item within an hardware system that can emit logs, e.g. service, process, subsystem,
	// interface, package etc.
	GetLoggableEntities(context.Context, *GetLoggableEntitiesRequest) (*GetLogLevelResponse, error)
	// Sets the log level of the device, for each given entity to a certain level.
	// If only one EntitiesLogLevel is provided for the device and that request contains only a log level with
	// no entity in the list it's assumed that the caller wants to set that level for all the entities.
	SetLogLevel(context.Context, *SetLogLevelRequest) (*SetLogLevelResponse, error)
	// Gets the configured log level for a certain entity on a certain device.
	// If no entity is specified in the request all the entities with their log level should be returned.
	GetLogLevel(context.Context, *GetLogLevelRequest) (*GetLogLevelResponse, error)
}

func RegisterNativeHWManagementServiceServer(s *grpc.Server, srv NativeHWManagementServiceServer) {
	s.RegisterService(&_NativeHWManagementService_serviceDesc, srv)
}

func _NativeHWManagementService_StartManagingDevice_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ModifiableComponent)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(NativeHWManagementServiceServer).StartManagingDevice(m, &nativeHWManagementServiceStartManagingDeviceServer{stream})
}

type NativeHWManagementService_StartManagingDeviceServer interface {
	Send(*StartManagingDeviceResponse) error
	grpc.ServerStream
}

type nativeHWManagementServiceStartManagingDeviceServer struct {
	grpc.ServerStream
}

func (x *nativeHWManagementServiceStartManagingDeviceServer) Send(m *StartManagingDeviceResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _NativeHWManagementService_StopManagingDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(StopManagingDeviceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).StopManagingDevice(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/StopManagingDevice",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).StopManagingDevice(ctx, req.(*StopManagingDeviceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetManagedDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(empty.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).GetManagedDevices(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/GetManagedDevices",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).GetManagedDevices(ctx, req.(*empty.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetPhysicalInventory_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(PhysicalInventoryRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(NativeHWManagementServiceServer).GetPhysicalInventory(m, &nativeHWManagementServiceGetPhysicalInventoryServer{stream})
}

type NativeHWManagementService_GetPhysicalInventoryServer interface {
	Send(*PhysicalInventoryResponse) error
	grpc.ServerStream
}

type nativeHWManagementServiceGetPhysicalInventoryServer struct {
	grpc.ServerStream
}

func (x *nativeHWManagementServiceGetPhysicalInventoryServer) Send(m *PhysicalInventoryResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _NativeHWManagementService_GetHWComponentInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(HWComponentInfoGetRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(NativeHWManagementServiceServer).GetHWComponentInfo(m, &nativeHWManagementServiceGetHWComponentInfoServer{stream})
}

type NativeHWManagementService_GetHWComponentInfoServer interface {
	Send(*HWComponentInfoGetResponse) error
	grpc.ServerStream
}

type nativeHWManagementServiceGetHWComponentInfoServer struct {
	grpc.ServerStream
}

func (x *nativeHWManagementServiceGetHWComponentInfoServer) Send(m *HWComponentInfoGetResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _NativeHWManagementService_SetHWComponentInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(HWComponentInfoSetRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).SetHWComponentInfo(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/SetHWComponentInfo",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).SetHWComponentInfo(ctx, req.(*HWComponentInfoSetRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_SetLoggingEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetLoggingEndpointRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).SetLoggingEndpoint(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/SetLoggingEndpoint",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).SetLoggingEndpoint(ctx, req.(*SetLoggingEndpointRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetLoggingEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(HardwareID)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).GetLoggingEndpoint(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/GetLoggingEndpoint",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).GetLoggingEndpoint(ctx, req.(*HardwareID))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_SetMsgBusEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetMsgBusEndpointRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).SetMsgBusEndpoint(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/SetMsgBusEndpoint",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).SetMsgBusEndpoint(ctx, req.(*SetMsgBusEndpointRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetMsgBusEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(empty.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).GetMsgBusEndpoint(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/GetMsgBusEndpoint",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).GetMsgBusEndpoint(ctx, req.(*empty.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetLoggableEntities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetLoggableEntitiesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).GetLoggableEntities(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/GetLoggableEntities",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).GetLoggableEntities(ctx, req.(*GetLoggableEntitiesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_SetLogLevel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetLogLevelRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).SetLogLevel(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/SetLogLevel",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).SetLogLevel(ctx, req.(*SetLogLevelRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _NativeHWManagementService_GetLogLevel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetLogLevelRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).GetLogLevel(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/GetLogLevel",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).GetLogLevel(ctx, req.(*GetLogLevelRequest))
	}
	return interceptor(ctx, in, info, handler)
}

var _NativeHWManagementService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "dmi.NativeHWManagementService",
	HandlerType: (*NativeHWManagementServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "StopManagingDevice",
			Handler:    _NativeHWManagementService_StopManagingDevice_Handler,
		},
		{
			MethodName: "GetManagedDevices",
			Handler:    _NativeHWManagementService_GetManagedDevices_Handler,
		},
		{
			MethodName: "SetHWComponentInfo",
			Handler:    _NativeHWManagementService_SetHWComponentInfo_Handler,
		},
		{
			MethodName: "SetLoggingEndpoint",
			Handler:    _NativeHWManagementService_SetLoggingEndpoint_Handler,
		},
		{
			MethodName: "GetLoggingEndpoint",
			Handler:    _NativeHWManagementService_GetLoggingEndpoint_Handler,
		},
		{
			MethodName: "SetMsgBusEndpoint",
			Handler:    _NativeHWManagementService_SetMsgBusEndpoint_Handler,
		},
		{
			MethodName: "GetMsgBusEndpoint",
			Handler:    _NativeHWManagementService_GetMsgBusEndpoint_Handler,
		},
		{
			MethodName: "GetLoggableEntities",
			Handler:    _NativeHWManagementService_GetLoggableEntities_Handler,
		},
		{
			MethodName: "SetLogLevel",
			Handler:    _NativeHWManagementService_SetLogLevel_Handler,
		},
		{
			MethodName: "GetLogLevel",
			Handler:    _NativeHWManagementService_GetLogLevel_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StartManagingDevice",
			Handler:       _NativeHWManagementService_StartManagingDevice_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetPhysicalInventory",
			Handler:       _NativeHWManagementService_GetPhysicalInventory_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetHWComponentInfo",
			Handler:       _NativeHWManagementService_GetHWComponentInfo_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "dmi/hw_management_service.proto",
}
