// 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"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	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
	HWComponentInfoSetResponse_SET_UNSUPPORTED    HWComponentInfoSetResponse_Reason = 6
)

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",
	6: "SET_UNSUPPORTED",
}

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,
	"SET_UNSUPPORTED":    6,
}

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
	// AUTHENTICATION_FAILURE is returned when the device management software/server is not able to connect to the underlying
	// hardware because of authentication failures
	StartManagingDeviceResponse_AUTHENTICATION_FAILURE StartManagingDeviceResponse_Reason = 5
	// INCOMPATIBLE_DEVICE is returned when there is a mismatch between the device management software/server and the underlying
	// hardware
	StartManagingDeviceResponse_INCOMPATIBLE_DEVICE StartManagingDeviceResponse_Reason = 6
)

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",
	5: "AUTHENTICATION_FAILURE",
	6: "INCOMPATIBLE_DEVICE",
}

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,
	"AUTHENTICATION_FAILURE":        5,
	"INCOMPATIBLE_DEVICE":           6,
}

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
	// DEVICE_UNREACHABLE is to be returned when the device manager cannot reach the device and stop managing it
	StopManagingDeviceResponse_DEVICE_UNREACHABLE StopManagingDeviceResponse_Reason = 2
)

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

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

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 ManagedDevicesResponse_Reason int32

const (
	ManagedDevicesResponse_UNDEFINED_REASON ManagedDevicesResponse_Reason = 0
	ManagedDevicesResponse_INTERNAL_ERROR   ManagedDevicesResponse_Reason = 1
)

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

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

func (x ManagedDevicesResponse_Reason) String() string {
	return proto.EnumName(ManagedDevicesResponse_Reason_name, int32(x))
}

func (ManagedDevicesResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{10, 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{12, 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{13, 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{15, 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{18, 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{20, 0}
}

type SetDmLogLevelResponse_Reason int32

const (
	SetDmLogLevelResponse_UNDEFINED_REASON  SetDmLogLevelResponse_Reason = 0
	SetDmLogLevelResponse_INTERNAL_ERROR    SetDmLogLevelResponse_Reason = 1
	SetDmLogLevelResponse_UNKNOWN_LOG_LEVEL SetDmLogLevelResponse_Reason = 2
)

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

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

func (x SetDmLogLevelResponse_Reason) String() string {
	return proto.EnumName(SetDmLogLevelResponse_Reason_name, int32(x))
}

func (SetDmLogLevelResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{23, 0}
}

type GetDmLogLevelResponse_Reason int32

const (
	GetDmLogLevelResponse_UNDEFINED_REASON GetDmLogLevelResponse_Reason = 0
	GetDmLogLevelResponse_INTERNAL_ERROR   GetDmLogLevelResponse_Reason = 1
)

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

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

func (x GetDmLogLevelResponse_Reason) String() string {
	return proto.EnumName(GetDmLogLevelResponse_Reason_name, int32(x))
}

func (GetDmLogLevelResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{25, 0}
}

type RebootDeviceResponse_Reason int32

const (
	RebootDeviceResponse_UNDEFINED_REASON      RebootDeviceResponse_Reason = 0
	RebootDeviceResponse_UNKNOWN_DEVICE        RebootDeviceResponse_Reason = 1
	RebootDeviceResponse_INTERNAL_ERROR        RebootDeviceResponse_Reason = 2
	RebootDeviceResponse_DEVICE_UNREACHABLE    RebootDeviceResponse_Reason = 3
	RebootDeviceResponse_DEVICE_IN_WRONG_STATE RebootDeviceResponse_Reason = 4
)

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

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

func (x RebootDeviceResponse_Reason) String() string {
	return proto.EnumName(RebootDeviceResponse_Reason_name, int32(x))
}

func (RebootDeviceResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{28, 0}
}

type DisableHWComponentResponse_Reason int32

const (
	DisableHWComponentResponse_UNDEFINED_REASON    DisableHWComponentResponse_Reason = 0
	DisableHWComponentResponse_UNKNOWN_DEVICE      DisableHWComponentResponse_Reason = 1
	DisableHWComponentResponse_UNKNOWN_COMPONENT   DisableHWComponentResponse_Reason = 2
	DisableHWComponentResponse_INTERNAL_ERROR      DisableHWComponentResponse_Reason = 3
	DisableHWComponentResponse_DEVICE_UNREACHABLE  DisableHWComponentResponse_Reason = 4
	DisableHWComponentResponse_DISABLE_UNSUPPORTED DisableHWComponentResponse_Reason = 5
	DisableHWComponentResponse_INVALID_PARAMS      DisableHWComponentResponse_Reason = 6
)

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

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

func (x DisableHWComponentResponse_Reason) String() string {
	return proto.EnumName(DisableHWComponentResponse_Reason_name, int32(x))
}

func (DisableHWComponentResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{30, 0}
}

type ResetHWComponentResponse_Reason int32

const (
	ResetHWComponentResponse_UNDEFINED_REASON   ResetHWComponentResponse_Reason = 0
	ResetHWComponentResponse_UNKNOWN_DEVICE     ResetHWComponentResponse_Reason = 1
	ResetHWComponentResponse_UNKNOWN_COMPONENT  ResetHWComponentResponse_Reason = 2
	ResetHWComponentResponse_INTERNAL_ERROR     ResetHWComponentResponse_Reason = 3
	ResetHWComponentResponse_DEVICE_UNREACHABLE ResetHWComponentResponse_Reason = 4
	ResetHWComponentResponse_RESET_UNSUPPORTED  ResetHWComponentResponse_Reason = 5
	ResetHWComponentResponse_INVALID_PARAMS     ResetHWComponentResponse_Reason = 6
)

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

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

func (x ResetHWComponentResponse_Reason) String() string {
	return proto.EnumName(ResetHWComponentResponse_Reason_name, int32(x))
}

func (ResetHWComponentResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{32, 0}
}

type EnableHWComponentResponse_Reason int32

const (
	EnableHWComponentResponse_UNDEFINED_REASON   EnableHWComponentResponse_Reason = 0
	EnableHWComponentResponse_UNKNOWN_DEVICE     EnableHWComponentResponse_Reason = 1
	EnableHWComponentResponse_UNKNOWN_COMPONENT  EnableHWComponentResponse_Reason = 2
	EnableHWComponentResponse_INTERNAL_ERROR     EnableHWComponentResponse_Reason = 3
	EnableHWComponentResponse_DEVICE_UNREACHABLE EnableHWComponentResponse_Reason = 4
	EnableHWComponentResponse_ENABLE_UNSUPPORTED EnableHWComponentResponse_Reason = 5
	EnableHWComponentResponse_INVALID_PARAMS     EnableHWComponentResponse_Reason = 6
)

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

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

func (x EnableHWComponentResponse_Reason) String() string {
	return proto.EnumName(EnableHWComponentResponse_Reason_name, int32(x))
}

func (EnableHWComponentResponse_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{34, 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"`
	// It is recommended that upstream components/users of the DMI interface
	// do not really interpret/parse the reson_detail, but rather use it for
	// display purposes to the end user or use it for logging the error
	ReasonDetail         string   `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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
}

func (m *PhysicalInventoryResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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"`
	ReasonDetail         string                            `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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
}

func (m *HWComponentInfoGetResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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"`
	ReasonDetail         string                            `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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
}

func (m *HWComponentInfoSetResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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"`
	ReasonDetail         string                             `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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
}

func (m *StartManagingDeviceResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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"`
	ReasonDetail         string                            `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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
}

func (m *StopManagingDeviceResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

type ManagedDeviceInfo struct {
	Info                 *ModifiableComponent `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	DeviceUuid           *Uuid                `protobuf:"bytes,2,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 *ManagedDeviceInfo) Reset()         { *m = ManagedDeviceInfo{} }
func (m *ManagedDeviceInfo) String() string { return proto.CompactTextString(m) }
func (*ManagedDeviceInfo) ProtoMessage()    {}
func (*ManagedDeviceInfo) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{9}
}

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

var xxx_messageInfo_ManagedDeviceInfo proto.InternalMessageInfo

func (m *ManagedDeviceInfo) GetInfo() *ModifiableComponent {
	if m != nil {
		return m.Info
	}
	return nil
}

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

type ManagedDevicesResponse struct {
	Status               Status                        `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               ManagedDevicesResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.ManagedDevicesResponse_Reason" json:"reason,omitempty"`
	Devices              []*ManagedDeviceInfo          `protobuf:"bytes,3,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{10}
}

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) GetStatus() Status {
	if m != nil {
		return m.Status
	}
	return Status_UNDEFINED_STATUS
}

func (m *ManagedDevicesResponse) GetReason() ManagedDevicesResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return ManagedDevicesResponse_UNDEFINED_REASON
}

func (m *ManagedDevicesResponse) GetDevices() []*ManagedDeviceInfo {
	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{11}
}

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"`
	ReasonDetail         string                           `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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{12}
}

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
}

func (m *SetRemoteEndpointResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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"`
	ReasonDetail         string                            `protobuf:"bytes,5,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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{13}
}

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 ""
}

func (m *GetLoggingEndpointResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	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{14}
}

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"`
	ReasonDetail         string                           `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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{15}
}

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 ""
}

func (m *GetMsgBusEndpointResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	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{16}
}

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{17}
}

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"`
	ReasonDetail         string                     `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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{18}
}

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
}

func (m *SetLogLevelResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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{19}
}

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"`
	ReasonDetail         string                     `protobuf:"bytes,5,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,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{20}
}

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
}

func (m *GetLogLevelResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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{21}
}

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
}

type SetDmLogLevelRequest struct {
	Level                LogLevel `protobuf:"varint,1,opt,name=level,proto3,enum=dmi.LogLevel" json:"level,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_SetDmLogLevelRequest proto.InternalMessageInfo

func (m *SetDmLogLevelRequest) GetLevel() LogLevel {
	if m != nil {
		return m.Level
	}
	return LogLevel_TRACE
}

type SetDmLogLevelResponse struct {
	Status               Status                       `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               SetDmLogLevelResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.SetDmLogLevelResponse_Reason" json:"reason,omitempty"`
	ReasonDetail         string                       `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
	XXX_unrecognized     []byte                       `json:"-"`
	XXX_sizecache        int32                        `json:"-"`
}

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

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

var xxx_messageInfo_SetDmLogLevelResponse proto.InternalMessageInfo

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

func (m *SetDmLogLevelResponse) GetReason() SetDmLogLevelResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return SetDmLogLevelResponse_UNDEFINED_REASON
}

func (m *SetDmLogLevelResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

type GetDmLogLevelRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_GetDmLogLevelRequest proto.InternalMessageInfo

type GetDmLogLevelResponse struct {
	Level                LogLevel                     `protobuf:"varint,1,opt,name=level,proto3,enum=dmi.LogLevel" json:"level,omitempty"`
	Status               Status                       `protobuf:"varint,2,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               GetDmLogLevelResponse_Reason `protobuf:"varint,3,opt,name=reason,proto3,enum=dmi.GetDmLogLevelResponse_Reason" json:"reason,omitempty"`
	ReasonDetail         string                       `protobuf:"bytes,4,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
	XXX_unrecognized     []byte                       `json:"-"`
	XXX_sizecache        int32                        `json:"-"`
}

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

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

var xxx_messageInfo_GetDmLogLevelResponse proto.InternalMessageInfo

func (m *GetDmLogLevelResponse) GetLevel() LogLevel {
	if m != nil {
		return m.Level
	}
	return LogLevel_TRACE
}

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

func (m *GetDmLogLevelResponse) GetReason() GetDmLogLevelResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return GetDmLogLevelResponse_UNDEFINED_REASON
}

func (m *GetDmLogLevelResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

type Heartbeat struct {
	HeartbeatSignature   uint32   `protobuf:"fixed32,1,opt,name=heartbeat_signature,json=heartbeatSignature,proto3" json:"heartbeat_signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_Heartbeat proto.InternalMessageInfo

func (m *Heartbeat) GetHeartbeatSignature() uint32 {
	if m != nil {
		return m.HeartbeatSignature
	}
	return 0
}

type RebootDeviceRequest 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 *RebootDeviceRequest) Reset()         { *m = RebootDeviceRequest{} }
func (m *RebootDeviceRequest) String() string { return proto.CompactTextString(m) }
func (*RebootDeviceRequest) ProtoMessage()    {}
func (*RebootDeviceRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{27}
}

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

var xxx_messageInfo_RebootDeviceRequest proto.InternalMessageInfo

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

type RebootDeviceResponse struct {
	Status               Status                      `protobuf:"varint,3,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason               RebootDeviceResponse_Reason `protobuf:"varint,4,opt,name=reason,proto3,enum=dmi.RebootDeviceResponse_Reason" json:"reason,omitempty"`
	ReasonDetail         string                      `protobuf:"bytes,5,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
	XXX_unrecognized     []byte                      `json:"-"`
	XXX_sizecache        int32                       `json:"-"`
}

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

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

var xxx_messageInfo_RebootDeviceResponse proto.InternalMessageInfo

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

func (m *RebootDeviceResponse) GetReason() RebootDeviceResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return RebootDeviceResponse_UNDEFINED_REASON
}

func (m *RebootDeviceResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

// Request to disable a hardware component on a device.
// At least one of component_name or component_uuid must be provided, along with device_uuid.
type DisableHWComponentRequest struct {
	// UUID of the device containing the component to disable (required)
	DeviceUuid *Uuid `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	// UUID of the component to disable (optional, but either this or component_name must be set)
	ComponentUuid *Uuid `protobuf:"bytes,2,opt,name=component_uuid,json=componentUuid,proto3" json:"component_uuid,omitempty"`
	// Name of the component to disable (optional, but either this or component_uuid must be set)
	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 *DisableHWComponentRequest) Reset()         { *m = DisableHWComponentRequest{} }
func (m *DisableHWComponentRequest) String() string { return proto.CompactTextString(m) }
func (*DisableHWComponentRequest) ProtoMessage()    {}
func (*DisableHWComponentRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{29}
}

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

var xxx_messageInfo_DisableHWComponentRequest proto.InternalMessageInfo

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

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

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

// Response for DisableHWComponent RPC.
type DisableHWComponentResponse struct {
	// Indicates whether the operation was successful or not.
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	// Reason for failure, if any
	Reason DisableHWComponentResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.DisableHWComponentResponse_Reason" json:"reason,omitempty"`
	// Human-readable details for logging or display
	ReasonDetail         string   `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_DisableHWComponentResponse proto.InternalMessageInfo

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

func (m *DisableHWComponentResponse) GetReason() DisableHWComponentResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return DisableHWComponentResponse_UNDEFINED_REASON
}

func (m *DisableHWComponentResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

// Request to reset a hardware component on a device.
// At least one of component_name or component_uuid must be provided, along with device_uuid.
type ResetHWComponentRequest struct {
	// UUID of the device containing the component to reset (required)
	DeviceUuid *Uuid `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	// UUID of the component to reset (optional, but either this or component_name must be set)
	ComponentUuid *Uuid `protobuf:"bytes,2,opt,name=component_uuid,json=componentUuid,proto3" json:"component_uuid,omitempty"`
	// Name of the component to reset (optional, but either this or component_uuid must be set)
	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 *ResetHWComponentRequest) Reset()         { *m = ResetHWComponentRequest{} }
func (m *ResetHWComponentRequest) String() string { return proto.CompactTextString(m) }
func (*ResetHWComponentRequest) ProtoMessage()    {}
func (*ResetHWComponentRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{31}
}

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

var xxx_messageInfo_ResetHWComponentRequest proto.InternalMessageInfo

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

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

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

// Response for ResetHWComponent RPC.
type ResetHWComponentResponse struct {
	// Indicates whether the operation was successful or not.
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	// Reason for failure, if any
	Reason ResetHWComponentResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.ResetHWComponentResponse_Reason" json:"reason,omitempty"`
	// Human-readable details for logging or display
	ReasonDetail         string   `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_ResetHWComponentResponse proto.InternalMessageInfo

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

func (m *ResetHWComponentResponse) GetReason() ResetHWComponentResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return ResetHWComponentResponse_UNDEFINED_REASON
}

func (m *ResetHWComponentResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

// Request to enable a hardware component on a device.
// At least one of component_name or component_uuid must be provided, along with device_uuid.
type EnableHWComponentRequest struct {
	// UUID of the device containing the component to enable (required)
	DeviceUuid *Uuid `protobuf:"bytes,1,opt,name=device_uuid,json=deviceUuid,proto3" json:"device_uuid,omitempty"`
	// UUID of the component to enable (optional, but either this or component_name must be set)
	ComponentUuid *Uuid `protobuf:"bytes,2,opt,name=component_uuid,json=componentUuid,proto3" json:"component_uuid,omitempty"`
	// Name of the component to enable (optional, but either this or component_uuid must be set)
	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 *EnableHWComponentRequest) Reset()         { *m = EnableHWComponentRequest{} }
func (m *EnableHWComponentRequest) String() string { return proto.CompactTextString(m) }
func (*EnableHWComponentRequest) ProtoMessage()    {}
func (*EnableHWComponentRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_eae902e73066286d, []int{33}
}

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

var xxx_messageInfo_EnableHWComponentRequest proto.InternalMessageInfo

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

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

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

// Response for EnableHWComponent RPC.
type EnableHWComponentResponse struct {
	// Indicates whether the operation was successful or not.
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	// Reason for failure, if any
	Reason EnableHWComponentResponse_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.EnableHWComponentResponse_Reason" json:"reason,omitempty"`
	// Human-readable details for logging or display
	ReasonDetail         string   `protobuf:"bytes,3,opt,name=reason_detail,json=reasonDetail,proto3" json:"reason_detail,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_EnableHWComponentResponse proto.InternalMessageInfo

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

func (m *EnableHWComponentResponse) GetReason() EnableHWComponentResponse_Reason {
	if m != nil {
		return m.Reason
	}
	return EnableHWComponentResponse_UNDEFINED_REASON
}

func (m *EnableHWComponentResponse) GetReasonDetail() string {
	if m != nil {
		return m.ReasonDetail
	}
	return ""
}

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.ManagedDevicesResponse_Reason", ManagedDevicesResponse_Reason_name, ManagedDevicesResponse_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.RegisterEnum("dmi.SetDmLogLevelResponse_Reason", SetDmLogLevelResponse_Reason_name, SetDmLogLevelResponse_Reason_value)
	proto.RegisterEnum("dmi.GetDmLogLevelResponse_Reason", GetDmLogLevelResponse_Reason_name, GetDmLogLevelResponse_Reason_value)
	proto.RegisterEnum("dmi.RebootDeviceResponse_Reason", RebootDeviceResponse_Reason_name, RebootDeviceResponse_Reason_value)
	proto.RegisterEnum("dmi.DisableHWComponentResponse_Reason", DisableHWComponentResponse_Reason_name, DisableHWComponentResponse_Reason_value)
	proto.RegisterEnum("dmi.ResetHWComponentResponse_Reason", ResetHWComponentResponse_Reason_name, ResetHWComponentResponse_Reason_value)
	proto.RegisterEnum("dmi.EnableHWComponentResponse_Reason", EnableHWComponentResponse_Reason_name, EnableHWComponentResponse_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((*ManagedDeviceInfo)(nil), "dmi.ManagedDeviceInfo")
	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")
	proto.RegisterType((*SetDmLogLevelRequest)(nil), "dmi.SetDmLogLevelRequest")
	proto.RegisterType((*SetDmLogLevelResponse)(nil), "dmi.SetDmLogLevelResponse")
	proto.RegisterType((*GetDmLogLevelRequest)(nil), "dmi.GetDmLogLevelRequest")
	proto.RegisterType((*GetDmLogLevelResponse)(nil), "dmi.GetDmLogLevelResponse")
	proto.RegisterType((*Heartbeat)(nil), "dmi.Heartbeat")
	proto.RegisterType((*RebootDeviceRequest)(nil), "dmi.RebootDeviceRequest")
	proto.RegisterType((*RebootDeviceResponse)(nil), "dmi.RebootDeviceResponse")
	proto.RegisterType((*DisableHWComponentRequest)(nil), "dmi.DisableHWComponentRequest")
	proto.RegisterType((*DisableHWComponentResponse)(nil), "dmi.DisableHWComponentResponse")
	proto.RegisterType((*ResetHWComponentRequest)(nil), "dmi.ResetHWComponentRequest")
	proto.RegisterType((*ResetHWComponentResponse)(nil), "dmi.ResetHWComponentResponse")
	proto.RegisterType((*EnableHWComponentRequest)(nil), "dmi.EnableHWComponentRequest")
	proto.RegisterType((*EnableHWComponentResponse)(nil), "dmi.EnableHWComponentResponse")
}

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

var fileDescriptor_eae902e73066286d = []byte{
	// 1901 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x6f, 0xdb, 0xd8,
	0x11, 0x2f, 0x29, 0xdb, 0x59, 0x8d, 0x13, 0x47, 0x7e, 0x8e, 0x15, 0x49, 0x69, 0x62, 0x87, 0xe9,
	0x76, 0xb3, 0xed, 0xae, 0x15, 0x38, 0x87, 0x6e, 0xba, 0xdb, 0x0f, 0x59, 0xa2, 0x69, 0xee, 0xca,
	0x94, 0xf0, 0x28, 0xc5, 0x48, 0x51, 0x94, 0xa0, 0xa5, 0x67, 0x99, 0xa8, 0x48, 0xba, 0x22, 0xe5,
	0x85, 0xff, 0x8c, 0x1e, 0x7a, 0xe8, 0xa1, 0xdb, 0xb4, 0xff, 0x41, 0xaf, 0x41, 0xaf, 0x45, 0x0b,
	0xf4, 0xda, 0x63, 0x81, 0xa2, 0xa7, 0x9e, 0x5b, 0xa0, 0xf7, 0x05, 0xf9, 0x48, 0x7d, 0x90, 0x7c,
	0xfa, 0xa0, 0xb3, 0x88, 0x6f, 0xd6, 0x7b, 0xf3, 0x7e, 0x1c, 0xce, 0x6f, 0x66, 0x38, 0x33, 0xcf,
	0xb0, 0xd3, 0x35, 0x8d, 0xf2, 0xf9, 0x97, 0x9a, 0xa9, 0x5b, 0x7a, 0x8f, 0x98, 0xc4, 0x72, 0x35,
	0x87, 0x0c, 0x2e, 0x8d, 0x0e, 0xd9, 0xbb, 0x18, 0xd8, 0xae, 0x8d, 0x32, 0x5d, 0xd3, 0x28, 0x6d,
	0x7a, 0x52, 0x1d, 0xdb, 0x34, 0x6d, 0xcb, 0xa1, 0xeb, 0xa5, 0xdb, 0xf4, 0x60, 0xf0, 0xeb, 0x41,
	0xcf, 0xb6, 0x7b, 0x7d, 0x52, 0xf6, 0x7f, 0x9d, 0x0e, 0xcf, 0xca, 0xc4, 0xbc, 0x70, 0xaf, 0xe8,
	0xa6, 0x70, 0x08, 0x85, 0xe6, 0xf9, 0x95, 0x63, 0x74, 0xf4, 0xbe, 0x6c, 0x5d, 0x12, 0xcb, 0xb5,
	0x07, 0x57, 0x98, 0xfc, 0x6a, 0x48, 0x1c, 0x17, 0x7d, 0x0f, 0xd6, 0xbb, 0xc4, 0x7b, 0x9c, 0x36,
	0x1c, 0x1a, 0xdd, 0x02, 0xb7, 0xcb, 0x3d, 0x5d, 0xdf, 0xcf, 0xee, 0x75, 0x4d, 0x63, 0xaf, 0x3d,
	0x34, 0xba, 0x18, 0xe8, 0xae, 0xf7, 0xb7, 0xf0, 0x27, 0x1e, 0x8a, 0x09, 0x40, 0xce, 0x85, 0x6d,
	0x39, 0x04, 0x3d, 0x81, 0x35, 0xc7, 0xd5, 0xdd, 0xa1, 0xe3, 0x83, 0x6c, 0xec, 0xaf, 0xfb, 0x20,
	0xaa, 0xbf, 0x84, 0x83, 0x2d, 0xf4, 0x23, 0x58, 0x1b, 0x10, 0xdd, 0xb1, 0xad, 0x02, 0xef, 0x0b,
	0xbd, 0xef, 0x0b, 0x31, 0x41, 0xf7, 0xb0, 0x2f, 0x8c, 0x83, 0x43, 0xe8, 0xfb, 0x90, 0x35, 0x42,
	0x99, 0x42, 0xc6, 0xd7, 0xf5, 0x8e, 0x8f, 0x70, 0xa4, 0x0f, 0xba, 0x5f, 0xea, 0x03, 0x82, 0xc7,
	0xfb, 0xe8, 0x09, 0xdc, 0xa1, 0xc7, 0xb4, 0x2e, 0x71, 0x75, 0xa3, 0x5f, 0x58, 0xd9, 0xe5, 0x9e,
	0x66, 0xf1, 0x6d, 0xba, 0x58, 0xf3, 0xd7, 0x84, 0x5f, 0xc0, 0x1a, 0x7d, 0x06, 0xba, 0x07, 0xb9,
	0xb6, 0x52, 0x13, 0x0f, 0x65, 0x45, 0xac, 0x69, 0x58, 0xac, 0xa8, 0x0d, 0x25, 0xf7, 0x2d, 0x84,
	0x60, 0xa3, 0xad, 0x7c, 0xa1, 0x34, 0x4e, 0x14, 0xad, 0x26, 0xbe, 0x94, 0xab, 0x62, 0x8e, 0xf3,
	0xd6, 0x64, 0xa5, 0x25, 0x62, 0xa5, 0x52, 0xd7, 0x44, 0x8c, 0x1b, 0x38, 0xc7, 0xa3, 0x3c, 0x20,
	0xba, 0xaf, 0xb5, 0x15, 0x2c, 0x56, 0xaa, 0x47, 0x95, 0x83, 0xba, 0x98, 0xcb, 0x08, 0xaf, 0x39,
	0x28, 0x1e, 0x9d, 0x54, 0x6d, 0xf3, 0xc2, 0xb6, 0x88, 0xe5, 0xca, 0xd6, 0x99, 0x2d, 0x11, 0x37,
	0x85, 0xf5, 0xd1, 0x33, 0xd8, 0xe8, 0x84, 0x30, 0x54, 0x9c, 0x8f, 0x8a, 0xdf, 0x19, 0x09, 0xf8,
	0x27, 0xde, 0x9f, 0x3c, 0x61, 0xe9, 0x26, 0xf1, 0x4d, 0x96, 0x9d, 0x10, 0x53, 0x74, 0x93, 0x08,
	0x7f, 0xe7, 0xa1, 0x94, 0xa4, 0xe2, 0x32, 0xbc, 0xfe, 0x38, 0xc2, 0xeb, 0x77, 0x29, 0x2b, 0x4c,
	0xd4, 0x28, 0xb1, 0x1f, 0x41, 0x76, 0xa4, 0x54, 0x40, 0xec, 0x86, 0x0f, 0x31, 0x02, 0xc0, 0x63,
	0x81, 0xc5, 0x98, 0x1d, 0xa6, 0x60, 0x76, 0x1b, 0x36, 0xc3, 0xb5, 0x6a, 0xe3, 0xb8, 0xd9, 0x50,
	0x44, 0xa5, 0x95, 0xe3, 0x13, 0x08, 0xcf, 0x30, 0x08, 0x5f, 0x11, 0xfe, 0x11, 0x27, 0x5c, 0xbd,
	0x59, 0x84, 0xa3, 0x7d, 0xb8, 0xd5, 0x39, 0xd7, 0xad, 0x1e, 0x71, 0x7c, 0xc3, 0xad, 0xef, 0x17,
	0x7c, 0xc4, 0x63, 0xbb, 0x6b, 0x9c, 0x19, 0xfa, 0x69, 0x9f, 0x8c, 0x8d, 0x1e, 0x0a, 0x0a, 0x7f,
	0x8d, 0x3b, 0x89, 0xfa, 0x8d, 0x38, 0x89, 0xca, 0x76, 0x92, 0x18, 0xed, 0x99, 0x04, 0xda, 0xbf,
	0xe2, 0xde, 0x32, 0xef, 0x2f, 0x2b, 0x75, 0xb9, 0xa6, 0x35, 0x2b, 0xb8, 0x72, 0xac, 0xe6, 0x32,
	0x09, 0xbe, 0xb0, 0xc2, 0xf0, 0x85, 0x55, 0xb4, 0x05, 0x77, 0x55, 0xb1, 0xa5, 0xb5, 0x15, 0xb5,
	0xdd, 0x6c, 0x36, 0x70, 0x4b, 0xac, 0xe5, 0xd6, 0x84, 0x5f, 0x67, 0xe0, 0x81, 0xea, 0xea, 0x03,
	0xf7, 0xd8, 0x4b, 0xf9, 0x86, 0xd5, 0xab, 0xf9, 0x94, 0x2f, 0x67, 0xca, 0x9f, 0x44, 0x4c, 0xf9,
	0x41, 0x28, 0xc4, 0x82, 0x8d, 0xda, 0x32, 0xe2, 0x88, 0x99, 0x59, 0x8e, 0xb8, 0x50, 0xb8, 0xbd,
	0x99, 0x67, 0xf7, 0x12, 0xe4, 0x03, 0x23, 0x55, 0xea, 0x58, 0xac, 0xd4, 0x5e, 0x69, 0xc7, 0x15,
	0xa5, 0x22, 0x89, 0xb5, 0x1c, 0x87, 0x1e, 0xc3, 0xc3, 0x46, 0x53, 0xc4, 0x95, 0x96, 0xdc, 0x50,
	0x46, 0xdb, 0xb2, 0xa2, 0x35, 0x71, 0x43, 0xc2, 0xa2, 0xaa, 0x2e, 0xc1, 0x45, 0x09, 0xf2, 0x95,
	0x76, 0xeb, 0x48, 0x54, 0x5a, 0x72, 0x95, 0xe2, 0x1d, 0x56, 0xe4, 0x7a, 0x1b, 0x7b, 0x7c, 0xdc,
	0x87, 0x2d, 0x59, 0xf1, 0x08, 0xae, 0xb4, 0xe4, 0x83, 0xba, 0x18, 0xf2, 0xbf, 0x26, 0x94, 0xa1,
	0xa8, 0xba, 0xf6, 0x45, 0xd4, 0x74, 0x34, 0x66, 0x11, 0xac, 0xf8, 0xb1, 0xc4, 0xf9, 0x6f, 0xed,
	0xff, 0x2d, 0xfc, 0x8f, 0x83, 0x52, 0xd2, 0x89, 0xeb, 0x87, 0x03, 0x1b, 0x35, 0x55, 0x38, 0x7c,
	0x9e, 0x22, 0x1a, 0x92, 0xdd, 0x99, 0x17, 0x4c, 0xd8, 0xf4, 0x35, 0x23, 0x5d, 0xaa, 0x98, 0x17,
	0xae, 0xe8, 0x23, 0x58, 0x31, 0xac, 0x33, 0x3b, 0x48, 0x65, 0xec, 0x4c, 0xe2, 0x4b, 0x45, 0xdd,
	0x8e, 0x9f, 0x55, 0x6e, 0xfc, 0x8b, 0x83, 0xfc, 0xd4, 0xf3, 0x9c, 0xe5, 0xec, 0xfb, 0xc3, 0x88,
	0x7d, 0x05, 0xaa, 0x5b, 0x22, 0x62, 0xd4, 0xb6, 0xcf, 0xe0, 0x16, 0xd5, 0xc4, 0x29, 0x64, 0x76,
	0x33, 0x4f, 0xd7, 0xf7, 0xf3, 0xf1, 0xc3, 0xde, 0xeb, 0xe3, 0x50, 0x4c, 0xd8, 0x9f, 0x6f, 0xe8,
	0x88, 0xaf, 0x72, 0xc2, 0xef, 0x38, 0x28, 0xaa, 0xc4, 0xad, 0xdb, 0x3d, 0x8f, 0x6d, 0xd1, 0xea,
	0x5e, 0xd8, 0x86, 0x95, 0xea, 0x5b, 0xf1, 0x21, 0xe4, 0xfa, 0x14, 0x45, 0x23, 0x01, 0x8c, 0xff,
	0xd6, 0x59, 0x7c, 0xb7, 0x3f, 0x8d, 0x3e, 0x29, 0xea, 0x97, 0x87, 0x1d, 0x3b, 0xf4, 0x9c, 0x50,
	0xb4, 0x19, 0x2c, 0x0b, 0xff, 0xe6, 0x7d, 0xfd, 0x30, 0x31, 0x6d, 0x97, 0x8c, 0xd5, 0xbb, 0x7e,
	0xc1, 0xc7, 0x04, 0x4d, 0xe5, 0xe3, 0x6f, 0xb8, 0xb7, 0x54, 0xc4, 0x95, 0x20, 0x5f, 0x6f, 0x48,
	0x92, 0xac, 0x48, 0x9a, 0xa8, 0xd4, 0x9a, 0x0d, 0x59, 0x69, 0x8d, 0xbe, 0xf7, 0x4f, 0x60, 0x27,
	0xb6, 0xd7, 0xc4, 0x8d, 0x56, 0xa3, 0xda, 0x18, 0x27, 0x9f, 0x22, 0x6c, 0x1f, 0xab, 0xd2, 0x41,
	0x5b, 0x8d, 0x9e, 0x5f, 0x65, 0x04, 0xd5, 0x9a, 0xf0, 0x4f, 0x1e, 0x4a, 0x52, 0x82, 0x0f, 0x5c,
	0x3f, 0x93, 0xb0, 0x51, 0xa3, 0x56, 0x4e, 0xf2, 0x9e, 0xcc, 0xe2, 0xde, 0xb3, 0x92, 0xe8, 0x3d,
	0x71, 0xee, 0x56, 0xdf, 0x41, 0xfd, 0x5d, 0x85, 0x82, 0x4a, 0xdc, 0x63, 0xa7, 0x77, 0x30, 0x74,
	0xa2, 0x01, 0xf6, 0x01, 0xdc, 0x35, 0x9d, 0xde, 0xe9, 0xd0, 0x19, 0xbf, 0x35, 0xcd, 0xf1, 0x1b,
	0x74, 0x39, 0x94, 0x17, 0x7e, 0xcb, 0x43, 0x51, 0x8a, 0xa3, 0x5c, 0x3f, 0x0e, 0x98, 0xa0, 0x51,
	0x86, 0x12, 0x54, 0xcd, 0x24, 0xa9, 0xba, 0xd8, 0xb7, 0xfa, 0xf3, 0xe5, 0x73, 0x15, 0xf3, 0xa3,
	0xf0, 0x0a, 0x72, 0xa2, 0xe5, 0x1a, 0xae, 0x41, 0x9c, 0xba, 0xdd, 0xab, 0x93, 0x4b, 0xd2, 0x47,
	0x1f, 0xc2, 0x7b, 0xfd, 0xe0, 0xef, 0xc0, 0x26, 0xb4, 0x4b, 0x0b, 0x05, 0xf0, 0x68, 0x1b, 0x95,
	0xe0, 0x3d, 0x12, 0x1c, 0x2f, 0xf0, 0xbb, 0x99, 0xa7, 0x59, 0x3c, 0xfa, 0x2d, 0x0c, 0x01, 0xd1,
	0xec, 0x48, 0x0f, 0xa5, 0x48, 0x8b, 0xcf, 0x21, 0xdb, 0xf7, 0xfa, 0xe2, 0x4b, 0xd2, 0xa7, 0xf0,
	0xeb, 0xfb, 0xdb, 0xbe, 0x64, 0x54, 0x65, 0x3c, 0x96, 0x13, 0xfe, 0xcc, 0xc3, 0xd6, 0xd4, 0x73,
	0x03, 0x9e, 0x97, 0x79, 0xf0, 0xd8, 0x27, 0x78, 0xb6, 0x4f, 0xfc, 0x60, 0xe4, 0x13, 0x19, 0x5f,
	0x68, 0x27, 0xcc, 0x8d, 0xd1, 0x47, 0xcf, 0xcd, 0x8a, 0x49, 0x24, 0x5f, 0xbe, 0xbd, 0xc8, 0x0a,
	0xe5, 0xea, 0x0d, 0x2f, 0xf9, 0xb5, 0xe4, 0xd6, 0xab, 0x19, 0x0d, 0xd0, 0xcf, 0x01, 0x49, 0xd7,
	0x63, 0x6d, 0x96, 0x4f, 0xfc, 0x97, 0x87, 0x2d, 0xe9, 0x9a, 0xe4, 0x50, 0xaf, 0xa8, 0x2f, 0xe8,
	0x15, 0x54, 0x6e, 0x82, 0xd1, 0xcc, 0x22, 0x8c, 0xae, 0x4c, 0x30, 0x2a, 0xa5, 0x60, 0x74, 0xf5,
	0x06, 0x31, 0x7a, 0x34, 0xfa, 0x42, 0x79, 0x25, 0x5d, 0x68, 0xa4, 0x34, 0x13, 0xa4, 0x4f, 0xe1,
	0x9e, 0x4a, 0xdc, 0x9a, 0x19, 0xf5, 0x8e, 0x27, 0xb0, 0xda, 0x67, 0x67, 0x0b, 0xba, 0x27, 0xfc,
	0x87, 0x83, 0xed, 0xc8, 0xe9, 0x65, 0x32, 0xf0, 0x8b, 0x48, 0x06, 0x7e, 0x1c, 0x46, 0x5b, 0x1c,
	0x30, 0x55, 0x15, 0x22, 0xa7, 0x48, 0xaa, 0x13, 0x7d, 0xa7, 0xc7, 0x44, 0x5d, 0x7c, 0x29, 0xd6,
	0x73, 0xbc, 0x90, 0x87, 0x7b, 0x52, 0x82, 0x99, 0x84, 0xff, 0x73, 0xb0, 0x2d, 0x31, 0x2c, 0x30,
	0xdf, 0x80, 0x8b, 0x25, 0xa5, 0x17, 0x91, 0xa4, 0xf4, 0x38, 0x74, 0xe1, 0x14, 0x66, 0x4a, 0x4a,
	0x4b, 0x69, 0xea, 0xe4, 0xcf, 0x20, 0x7b, 0x44, 0xf4, 0x81, 0x7b, 0x4a, 0x74, 0x17, 0x95, 0x61,
	0xeb, 0x3c, 0xfc, 0xa1, 0x39, 0x46, 0xcf, 0xd2, 0xdd, 0xe1, 0x80, 0x76, 0x67, 0xb7, 0x30, 0x1a,
	0x6d, 0xa9, 0xe1, 0x8e, 0x50, 0x81, 0x2d, 0x4c, 0x4e, 0x6d, 0xdb, 0x9d, 0x6e, 0xeb, 0x96, 0xf1,
	0xdb, 0xdf, 0xf0, 0x70, 0x6f, 0x1a, 0x23, 0xe6, 0x79, 0x33, 0xb2, 0xc2, 0x27, 0x91, 0xac, 0xb0,
	0xeb, 0x0b, 0x25, 0xe1, 0xa5, 0x4a, 0x0b, 0x57, 0xdf, 0x6c, 0x09, 0xe5, 0x15, 0xb5, 0xc1, 0xba,
	0xac, 0x68, 0x27, 0xb8, 0xa1, 0x48, 0x9a, 0xda, 0xaa, 0xb4, 0xbc, 0xcc, 0xf0, 0x9a, 0x83, 0x62,
	0xcd, 0x70, 0xbc, 0xb4, 0x30, 0x31, 0xc6, 0xb9, 0x71, 0xd3, 0xcd, 0x24, 0x15, 0xaf, 0x5f, 0x5f,
	0xb3, 0x51, 0x53, 0xe5, 0x8f, 0x3f, 0x72, 0xef, 0x64, 0x60, 0x89, 0xee, 0xc3, 0x56, 0x4d, 0x56,
	0xbd, 0x1f, 0x53, 0x83, 0xaa, 0xd5, 0x84, 0x89, 0xcb, 0x9a, 0xf0, 0x15, 0x07, 0xf7, 0x31, 0x71,
	0x88, 0x7b, 0x53, 0xe9, 0xfe, 0x0b, 0x0f, 0x85, 0xb8, 0x82, 0xcb, 0x90, 0xfd, 0x59, 0x84, 0xec,
	0xef, 0x04, 0xd1, 0x9a, 0x8c, 0x99, 0x8a, 0xea, 0xd7, 0xef, 0x88, 0xea, 0x6d, 0xd8, 0xc4, 0x62,
	0x74, 0x22, 0x99, 0x4c, 0xf4, 0xef, 0x39, 0x28, 0x88, 0xd6, 0x4d, 0x0e, 0xec, 0xbf, 0xf1, 0x50,
	0x4c, 0xd0, 0xf0, 0xfa, 0x4d, 0x19, 0x13, 0x34, 0x15, 0xd7, 0x7f, 0x78, 0x47, 0x5c, 0xe7, 0x01,
	0x89, 0xca, 0x62, 0x51, 0xbd, 0xff, 0xe6, 0x36, 0x14, 0x15, 0xdd, 0x35, 0x2e, 0xc9, 0xd1, 0xc9,
	0xf1, 0xe8, 0x22, 0x52, 0xa5, 0xf7, 0x90, 0x48, 0x85, 0xad, 0x84, 0xc1, 0x32, 0x62, 0x8e, 0xfa,
	0x4a, 0xbb, 0xf3, 0x86, 0xd1, 0xcf, 0x38, 0xd4, 0x06, 0x14, 0x9f, 0x74, 0xa2, 0x47, 0xcc, 0x11,
	0xa8, 0xef, 0x78, 0xa5, 0x9d, 0x39, 0x23, 0x52, 0x74, 0x04, 0x9b, 0x5e, 0x4f, 0x3d, 0x35, 0xe3,
	0x43, 0xf9, 0x3d, 0x7a, 0x3b, 0xba, 0x17, 0xde, 0x8e, 0xee, 0x89, 0xe6, 0x85, 0x7b, 0x55, 0x7a,
	0x30, 0x63, 0x20, 0x88, 0x4e, 0xfc, 0x1a, 0x2c, 0x76, 0x33, 0x89, 0x1e, 0xb2, 0x6e, 0x2c, 0xa9,
	0x86, 0x8f, 0x66, 0x5f, 0x68, 0x3e, 0xe3, 0xd0, 0x89, 0xdf, 0x1f, 0x45, 0x6e, 0x3d, 0x82, 0x37,
	0x67, 0xde, 0x14, 0x06, 0x6f, 0xce, 0xbe, 0x50, 0x0b, 0x4c, 0xba, 0x20, 0xb0, 0x3a, 0x07, 0x78,
	0xf2, 0x6a, 0xa7, 0x15, 0x76, 0xe1, 0x53, 0x73, 0xa0, 0x47, 0x13, 0xbd, 0x6a, 0xc2, 0xf0, 0xb2,
	0xf4, 0x68, 0xf6, 0x9c, 0x0f, 0x1d, 0x86, 0x5d, 0xe2, 0x14, 0xea, 0xdd, 0xa9, 0xcb, 0x5c, 0xb9,
	0x56, 0xda, 0x99, 0x33, 0xc9, 0x42, 0x18, 0x36, 0x63, 0xf3, 0x9d, 0x80, 0x23, 0xd6, 0xdc, 0x67,
	0xae, 0x6e, 0x5f, 0x50, 0x27, 0x9a, 0xc6, 0x64, 0x39, 0xd1, 0xa3, 0xd9, 0x83, 0x1c, 0xd4, 0x0c,
	0xfb, 0xd5, 0xa9, 0xe6, 0x09, 0x4d, 0xbd, 0x58, 0x42, 0x5b, 0x55, 0x2a, 0xb0, 0x5a, 0x47, 0xf4,
	0x53, 0x58, 0x9f, 0x98, 0x11, 0xa0, 0xfb, 0xf1, 0xa9, 0xc1, 0x24, 0x82, 0x9a, 0x8c, 0x20, 0xc5,
	0x10, 0x24, 0x16, 0x42, 0x92, 0x0e, 0x9f, 0xc0, 0xc6, 0xa8, 0x22, 0xaf, 0x9e, 0x93, 0xce, 0x2f,
	0x99, 0xf6, 0xa1, 0xd7, 0xb8, 0xe3, 0xf2, 0xbd, 0x0a, 0xb7, 0x27, 0x2b, 0xdf, 0x20, 0x8d, 0x24,
	0x14, 0xe8, 0xa5, 0x22, 0xb3, 0x4c, 0x46, 0x87, 0x70, 0x67, 0xaa, 0x71, 0x43, 0xc5, 0xa4, 0x66,
	0x8e, 0xc2, 0x94, 0xd8, 0x7d, 0x9e, 0x87, 0x23, 0x25, 0xe0, 0x48, 0x6c, 0x9c, 0xe4, 0xf6, 0xab,
	0x0d, 0x28, 0x5e, 0x0d, 0x06, 0x31, 0xc2, 0xac, 0x8f, 0x03, 0xe7, 0x9e, 0x51, 0x9c, 0x36, 0x20,
	0x17, 0xad, 0x3b, 0xd0, 0xb7, 0x19, 0xe5, 0x08, 0x85, 0x7c, 0x38, 0xb3, 0x58, 0xf1, 0xa2, 0x25,
	0xf6, 0x75, 0x0b, 0xa2, 0x85, 0xf5, 0xb1, 0x0f, 0x1c, 0x9c, 0xf9, 0x51, 0x3c, 0xf8, 0xf4, 0x67,
	0x2f, 0x7a, 0x86, 0x7b, 0x3e, 0x3c, 0xdd, 0xeb, 0xd8, 0x66, 0xd9, 0xbe, 0x20, 0x56, 0xc7, 0x1e,
	0x74, 0xcb, 0xb4, 0x04, 0xf8, 0x78, 0xfc, 0x7f, 0x2d, 0x1f, 0x1b, 0x96, 0x4b, 0x06, 0x67, 0x7a,
	0x87, 0x94, 0x2f, 0x9f, 0x97, 0x7b, 0x76, 0xb9, 0x6b, 0x1a, 0xa7, 0x6b, 0xbe, 0xb7, 0x3c, 0xff,
	0x3a, 0x00, 0x00, 0xff, 0xff, 0xac, 0x7c, 0x97, 0xc0, 0x07, 0x23, 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)
	// Performs the heartbeat check
	HeartbeatCheck(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Heartbeat, error)
	// Performs the reboot of the device
	RebootDevice(ctx context.Context, in *RebootDeviceRequest, opts ...grpc.CallOption) (*RebootDeviceResponse, error)
	// Sets the log level of the Device Manager itself
	SetDmLogLevel(ctx context.Context, in *SetDmLogLevelRequest, opts ...grpc.CallOption) (*SetDmLogLevelResponse, error)
	// Gets the log level at which the Device Manager is running
	GetDmLogLevel(ctx context.Context, in *GetDmLogLevelRequest, opts ...grpc.CallOption) (*GetDmLogLevelResponse, error)
	// Disables a hardware component on a device.
	DisableHWComponent(ctx context.Context, in *DisableHWComponentRequest, opts ...grpc.CallOption) (*DisableHWComponentResponse, error)
	// Resets a hardware component on a device.
	ResetHWComponent(ctx context.Context, in *ResetHWComponentRequest, opts ...grpc.CallOption) (*ResetHWComponentResponse, error)
	// Enables a hardware component on a device.
	EnableHWComponent(ctx context.Context, in *EnableHWComponentRequest, opts ...grpc.CallOption) (*EnableHWComponentResponse, 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
}

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

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

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

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

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

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

func (c *nativeHWManagementServiceClient) EnableHWComponent(ctx context.Context, in *EnableHWComponentRequest, opts ...grpc.CallOption) (*EnableHWComponentResponse, error) {
	out := new(EnableHWComponentResponse)
	err := c.cc.Invoke(ctx, "/dmi.NativeHWManagementService/EnableHWComponent", 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)
	// Performs the heartbeat check
	HeartbeatCheck(context.Context, *empty.Empty) (*Heartbeat, error)
	// Performs the reboot of the device
	RebootDevice(context.Context, *RebootDeviceRequest) (*RebootDeviceResponse, error)
	// Sets the log level of the Device Manager itself
	SetDmLogLevel(context.Context, *SetDmLogLevelRequest) (*SetDmLogLevelResponse, error)
	// Gets the log level at which the Device Manager is running
	GetDmLogLevel(context.Context, *GetDmLogLevelRequest) (*GetDmLogLevelResponse, error)
	// Disables a hardware component on a device.
	DisableHWComponent(context.Context, *DisableHWComponentRequest) (*DisableHWComponentResponse, error)
	// Resets a hardware component on a device.
	ResetHWComponent(context.Context, *ResetHWComponentRequest) (*ResetHWComponentResponse, error)
	// Enables a hardware component on a device.
	EnableHWComponent(context.Context, *EnableHWComponentRequest) (*EnableHWComponentResponse, error)
}

// UnimplementedNativeHWManagementServiceServer can be embedded to have forward compatible implementations.
type UnimplementedNativeHWManagementServiceServer struct {
}

func (*UnimplementedNativeHWManagementServiceServer) StartManagingDevice(req *ModifiableComponent, srv NativeHWManagementService_StartManagingDeviceServer) error {
	return status.Errorf(codes.Unimplemented, "method StartManagingDevice not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) StopManagingDevice(ctx context.Context, req *StopManagingDeviceRequest) (*StopManagingDeviceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StopManagingDevice not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetManagedDevices(ctx context.Context, req *empty.Empty) (*ManagedDevicesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetManagedDevices not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetPhysicalInventory(req *PhysicalInventoryRequest, srv NativeHWManagementService_GetPhysicalInventoryServer) error {
	return status.Errorf(codes.Unimplemented, "method GetPhysicalInventory not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetHWComponentInfo(req *HWComponentInfoGetRequest, srv NativeHWManagementService_GetHWComponentInfoServer) error {
	return status.Errorf(codes.Unimplemented, "method GetHWComponentInfo not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) SetHWComponentInfo(ctx context.Context, req *HWComponentInfoSetRequest) (*HWComponentInfoSetResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetHWComponentInfo not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) SetLoggingEndpoint(ctx context.Context, req *SetLoggingEndpointRequest) (*SetRemoteEndpointResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetLoggingEndpoint not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetLoggingEndpoint(ctx context.Context, req *HardwareID) (*GetLoggingEndpointResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetLoggingEndpoint not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) SetMsgBusEndpoint(ctx context.Context, req *SetMsgBusEndpointRequest) (*SetRemoteEndpointResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetMsgBusEndpoint not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetMsgBusEndpoint(ctx context.Context, req *empty.Empty) (*GetMsgBusEndpointResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetMsgBusEndpoint not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetLoggableEntities(ctx context.Context, req *GetLoggableEntitiesRequest) (*GetLogLevelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetLoggableEntities not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) SetLogLevel(ctx context.Context, req *SetLogLevelRequest) (*SetLogLevelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetLogLevel not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetLogLevel(ctx context.Context, req *GetLogLevelRequest) (*GetLogLevelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetLogLevel not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) HeartbeatCheck(ctx context.Context, req *empty.Empty) (*Heartbeat, error) {
	return nil, status.Errorf(codes.Unimplemented, "method HeartbeatCheck not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) RebootDevice(ctx context.Context, req *RebootDeviceRequest) (*RebootDeviceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RebootDevice not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) SetDmLogLevel(ctx context.Context, req *SetDmLogLevelRequest) (*SetDmLogLevelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetDmLogLevel not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) GetDmLogLevel(ctx context.Context, req *GetDmLogLevelRequest) (*GetDmLogLevelResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetDmLogLevel not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) DisableHWComponent(ctx context.Context, req *DisableHWComponentRequest) (*DisableHWComponentResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DisableHWComponent not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) ResetHWComponent(ctx context.Context, req *ResetHWComponentRequest) (*ResetHWComponentResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ResetHWComponent not implemented")
}
func (*UnimplementedNativeHWManagementServiceServer) EnableHWComponent(ctx context.Context, req *EnableHWComponentRequest) (*EnableHWComponentResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method EnableHWComponent not implemented")
}

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)
}

func _NativeHWManagementService_HeartbeatCheck_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).HeartbeatCheck(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/HeartbeatCheck",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).HeartbeatCheck(ctx, req.(*empty.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

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

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

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

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

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

func _NativeHWManagementService_EnableHWComponent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EnableHWComponentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NativeHWManagementServiceServer).EnableHWComponent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/dmi.NativeHWManagementService/EnableHWComponent",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NativeHWManagementServiceServer).EnableHWComponent(ctx, req.(*EnableHWComponentRequest))
	}
	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,
		},
		{
			MethodName: "HeartbeatCheck",
			Handler:    _NativeHWManagementService_HeartbeatCheck_Handler,
		},
		{
			MethodName: "RebootDevice",
			Handler:    _NativeHWManagementService_RebootDevice_Handler,
		},
		{
			MethodName: "SetDmLogLevel",
			Handler:    _NativeHWManagementService_SetDmLogLevel_Handler,
		},
		{
			MethodName: "GetDmLogLevel",
			Handler:    _NativeHWManagementService_GetDmLogLevel_Handler,
		},
		{
			MethodName: "DisableHWComponent",
			Handler:    _NativeHWManagementService_DisableHWComponent_Handler,
		},
		{
			MethodName: "ResetHWComponent",
			Handler:    _NativeHWManagementService_ResetHWComponent_Handler,
		},
		{
			MethodName: "EnableHWComponent",
			Handler:    _NativeHWManagementService_EnableHWComponent_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",
}
