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

package dmi

import (
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	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 ImageStatus_ImageState int32

const (
	ImageStatus_UNDEFINED_STATE     ImageStatus_ImageState = 0
	ImageStatus_COPYING_IMAGE       ImageStatus_ImageState = 1
	ImageStatus_INSTALLING_IMAGE    ImageStatus_ImageState = 2
	ImageStatus_COMMITTING_IMAGE    ImageStatus_ImageState = 3
	ImageStatus_REBOOTING_DEVICE    ImageStatus_ImageState = 4
	ImageStatus_UPGRADE_COMPLETE    ImageStatus_ImageState = 5
	ImageStatus_UPGRADE_FAILED      ImageStatus_ImageState = 6
	ImageStatus_ACTIVATION_COMPLETE ImageStatus_ImageState = 7
	ImageStatus_ACTIVATION_FAILED   ImageStatus_ImageState = 8
)

var ImageStatus_ImageState_name = map[int32]string{
	0: "UNDEFINED_STATE",
	1: "COPYING_IMAGE",
	2: "INSTALLING_IMAGE",
	3: "COMMITTING_IMAGE",
	4: "REBOOTING_DEVICE",
	5: "UPGRADE_COMPLETE",
	6: "UPGRADE_FAILED",
	7: "ACTIVATION_COMPLETE",
	8: "ACTIVATION_FAILED",
}

var ImageStatus_ImageState_value = map[string]int32{
	"UNDEFINED_STATE":     0,
	"COPYING_IMAGE":       1,
	"INSTALLING_IMAGE":    2,
	"COMMITTING_IMAGE":    3,
	"REBOOTING_DEVICE":    4,
	"UPGRADE_COMPLETE":    5,
	"UPGRADE_FAILED":      6,
	"ACTIVATION_COMPLETE": 7,
	"ACTIVATION_FAILED":   8,
}

func (x ImageStatus_ImageState) String() string {
	return proto.EnumName(ImageStatus_ImageState_name, int32(x))
}

func (ImageStatus_ImageState) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_3d058607a829baf4, []int{2, 0}
}

type ImageStatus_Reason int32

const (
	ImageStatus_UNDEFINED_REASON              ImageStatus_Reason = 0
	ImageStatus_ERROR_IN_REQUEST              ImageStatus_Reason = 1
	ImageStatus_INTERNAL_ERROR                ImageStatus_Reason = 2
	ImageStatus_DEVICE_IN_WRONG_STATE         ImageStatus_Reason = 3
	ImageStatus_INVALID_IMAGE                 ImageStatus_Reason = 4
	ImageStatus_WRONG_IMAGE_CHECKSUM          ImageStatus_Reason = 5
	ImageStatus_OPERATION_ALREADY_IN_PROGRESS ImageStatus_Reason = 6
	ImageStatus_UNKNOWN_DEVICE                ImageStatus_Reason = 7
	// The DM implementations should have retry mechanisms (timeout values dependant on specific implementations)
	// and even after those if the operation cannot be completed/reached then return error with reason as DEVICE_NOT_REACHABLE
	ImageStatus_DEVICE_NOT_REACHABLE ImageStatus_Reason = 8
)

var ImageStatus_Reason_name = map[int32]string{
	0: "UNDEFINED_REASON",
	1: "ERROR_IN_REQUEST",
	2: "INTERNAL_ERROR",
	3: "DEVICE_IN_WRONG_STATE",
	4: "INVALID_IMAGE",
	5: "WRONG_IMAGE_CHECKSUM",
	6: "OPERATION_ALREADY_IN_PROGRESS",
	7: "UNKNOWN_DEVICE",
	8: "DEVICE_NOT_REACHABLE",
}

var ImageStatus_Reason_value = map[string]int32{
	"UNDEFINED_REASON":              0,
	"ERROR_IN_REQUEST":              1,
	"INTERNAL_ERROR":                2,
	"DEVICE_IN_WRONG_STATE":         3,
	"INVALID_IMAGE":                 4,
	"WRONG_IMAGE_CHECKSUM":          5,
	"OPERATION_ALREADY_IN_PROGRESS": 6,
	"UNKNOWN_DEVICE":                7,
	"DEVICE_NOT_REACHABLE":          8,
}

func (x ImageStatus_Reason) String() string {
	return proto.EnumName(ImageStatus_Reason_name, int32(x))
}

func (ImageStatus_Reason) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_3d058607a829baf4, []int{2, 1}
}

type ImageVersion struct {
	ImageName            string   `protobuf:"bytes,1,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"`
	Version              string   `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_ImageVersion proto.InternalMessageInfo

func (m *ImageVersion) GetImageName() string {
	if m != nil {
		return m.ImageName
	}
	return ""
}

func (m *ImageVersion) GetVersion() string {
	if m != nil {
		return m.Version
	}
	return ""
}

type ImageInformation struct {
	Image *ImageVersion `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// Script used by the device specific managers to install the image.
	// Script must be included in the object downloaded from the image_url
	ImageInstallScript string `protobuf:"bytes,2,opt,name=image_install_script,json=imageInstallScript,proto3" json:"image_install_script,omitempty"`
	// Location of the image and installation script, authentication (user/pass) if any should be in the url string
	// The image_url would contain the protocol, credentials, the IP address/DNS of the server and the path of the file
	// e.g. sftp://download_user:download_pass@192.168.0.1:22/images/image1
	ImageUrl string `protobuf:"bytes,3,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"`
	// SHA-256 sum of the image (sha256sum on Linux)
	Sha256Sum            string   `protobuf:"bytes,5,opt,name=sha256sum,proto3" json:"sha256sum,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

var xxx_messageInfo_ImageInformation proto.InternalMessageInfo

func (m *ImageInformation) GetImage() *ImageVersion {
	if m != nil {
		return m.Image
	}
	return nil
}

func (m *ImageInformation) GetImageInstallScript() string {
	if m != nil {
		return m.ImageInstallScript
	}
	return ""
}

func (m *ImageInformation) GetImageUrl() string {
	if m != nil {
		return m.ImageUrl
	}
	return ""
}

func (m *ImageInformation) GetSha256Sum() string {
	if m != nil {
		return m.Sha256Sum
	}
	return ""
}

type ImageStatus struct {
	Status Status                 `protobuf:"varint,1,opt,name=status,proto3,enum=dmi.Status" json:"status,omitempty"`
	Reason ImageStatus_Reason     `protobuf:"varint,2,opt,name=reason,proto3,enum=dmi.ImageStatus_Reason" json:"reason,omitempty"`
	State  ImageStatus_ImageState `protobuf:"varint,3,opt,name=state,proto3,enum=dmi.ImageStatus_ImageState" json:"state,omitempty"`
	// description contains more information about the current state of the procedure and is device dependant
	Description          string   `protobuf:"bytes,4,opt,name=description,proto3" json:"description,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 *ImageStatus) Reset()         { *m = ImageStatus{} }
func (m *ImageStatus) String() string { return proto.CompactTextString(m) }
func (*ImageStatus) ProtoMessage()    {}
func (*ImageStatus) Descriptor() ([]byte, []int) {
	return fileDescriptor_3d058607a829baf4, []int{2}
}

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

var xxx_messageInfo_ImageStatus proto.InternalMessageInfo

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

func (m *ImageStatus) GetReason() ImageStatus_Reason {
	if m != nil {
		return m.Reason
	}
	return ImageStatus_UNDEFINED_REASON
}

func (m *ImageStatus) GetState() ImageStatus_ImageState {
	if m != nil {
		return m.State
	}
	return ImageStatus_UNDEFINED_STATE
}

func (m *ImageStatus) GetDescription() string {
	if m != nil {
		return m.Description
	}
	return ""
}

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

func init() {
	proto.RegisterEnum("dmi.ImageStatus_ImageState", ImageStatus_ImageState_name, ImageStatus_ImageState_value)
	proto.RegisterEnum("dmi.ImageStatus_Reason", ImageStatus_Reason_name, ImageStatus_Reason_value)
	proto.RegisterType((*ImageVersion)(nil), "dmi.ImageVersion")
	proto.RegisterType((*ImageInformation)(nil), "dmi.ImageInformation")
	proto.RegisterType((*ImageStatus)(nil), "dmi.ImageStatus")
}

func init() { proto.RegisterFile("dmi/sw_image.proto", fileDescriptor_3d058607a829baf4) }

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