github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1alpha2/os_image_profile/os_image_profile.pb.object_ext.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/devices/proto/v1alpha2/os_image_profile.proto
     3  // DO NOT EDIT!!!
     4  
     5  package os_image_profile
     6  
     7  import (
     8  	"fmt"
     9  	"sort"
    10  
    11  	"google.golang.org/protobuf/proto"
    12  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    13  
    14  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    15  )
    16  
    17  // proto imports
    18  import (
    19  	device_type "github.com/cloudwan/edgelq-sdk/devices/resources/v1alpha2/device_type"
    20  	project "github.com/cloudwan/edgelq-sdk/devices/resources/v1alpha2/project"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    22  )
    23  
    24  // ensure the imports are used
    25  var (
    26  	_ = new(fmt.Stringer)
    27  	_ = new(sort.Interface)
    28  
    29  	_ = new(proto.Message)
    30  	_ = googlefieldmaskpb.FieldMask{}
    31  
    32  	_ = new(gotenobject.FieldPath)
    33  )
    34  
    35  // make sure we're using proto imports
    36  var (
    37  	_ = &device_type.DeviceType{}
    38  	_ = &project.Project{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func (o *OsImageProfile) GotenObjectExt() {}
    43  
    44  func (o *OsImageProfile) MakeFullFieldMask() *OsImageProfile_FieldMask {
    45  	return FullOsImageProfile_FieldMask()
    46  }
    47  
    48  func (o *OsImageProfile) MakeRawFullFieldMask() gotenobject.FieldMask {
    49  	return FullOsImageProfile_FieldMask()
    50  }
    51  
    52  func (o *OsImageProfile) MakeDiffFieldMask(other *OsImageProfile) *OsImageProfile_FieldMask {
    53  	if o == nil && other == nil {
    54  		return &OsImageProfile_FieldMask{}
    55  	}
    56  	if o == nil || other == nil {
    57  		return FullOsImageProfile_FieldMask()
    58  	}
    59  
    60  	res := &OsImageProfile_FieldMask{}
    61  	if o.GetName().String() != other.GetName().String() {
    62  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorName})
    63  	}
    64  	{
    65  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    66  		if subMask.IsFull() {
    67  			res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorMetadata})
    68  		} else {
    69  			for _, subpath := range subMask.Paths {
    70  				res.Paths = append(res.Paths, &OsImageProfile_FieldSubPath{selector: OsImageProfile_FieldPathSelectorMetadata, subPath: subpath})
    71  			}
    72  		}
    73  	}
    74  	if o.GetDisplayName() != other.GetDisplayName() {
    75  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorDisplayName})
    76  	}
    77  	if o.GetDeviceType().String() != other.GetDeviceType().String() {
    78  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorDeviceType})
    79  	}
    80  	if o.GetInstallAiAccelerator() != other.GetInstallAiAccelerator() {
    81  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorInstallAiAccelerator})
    82  	}
    83  	if o.GetEncryption() != other.GetEncryption() {
    84  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorEncryption})
    85  	}
    86  	if o.GetDiskMapping() != other.GetDiskMapping() {
    87  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorDiskMapping})
    88  	}
    89  	if o.GetNetworkAgent() != other.GetNetworkAgent() {
    90  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorNetworkAgent})
    91  	}
    92  	if o.GetNtp() != other.GetNtp() {
    93  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorNtp})
    94  	}
    95  	if o.GetHttpProxy() != other.GetHttpProxy() {
    96  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorHttpProxy})
    97  	}
    98  	if o.GetHttpsProxy() != other.GetHttpsProxy() {
    99  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorHttpsProxy})
   100  	}
   101  	if o.GetNoProxy() != other.GetNoProxy() {
   102  		res.Paths = append(res.Paths, &OsImageProfile_FieldTerminalPath{selector: OsImageProfile_FieldPathSelectorNoProxy})
   103  	}
   104  	return res
   105  }
   106  
   107  func (o *OsImageProfile) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   108  	return o.MakeDiffFieldMask(other.(*OsImageProfile))
   109  }
   110  
   111  func (o *OsImageProfile) Clone() *OsImageProfile {
   112  	if o == nil {
   113  		return nil
   114  	}
   115  	result := &OsImageProfile{}
   116  	if o.Name == nil {
   117  		result.Name = nil
   118  	} else if data, err := o.Name.ProtoString(); err != nil {
   119  		panic(err)
   120  	} else {
   121  		result.Name = &Name{}
   122  		if err := result.Name.ParseProtoString(data); err != nil {
   123  			panic(err)
   124  		}
   125  	}
   126  	result.Metadata = o.Metadata.Clone()
   127  	result.DisplayName = o.DisplayName
   128  	if o.DeviceType == nil {
   129  		result.DeviceType = nil
   130  	} else if data, err := o.DeviceType.ProtoString(); err != nil {
   131  		panic(err)
   132  	} else {
   133  		result.DeviceType = &device_type.Reference{}
   134  		if err := result.DeviceType.ParseProtoString(data); err != nil {
   135  			panic(err)
   136  		}
   137  	}
   138  	result.InstallAiAccelerator = o.InstallAiAccelerator
   139  	result.Encryption = o.Encryption
   140  	result.DiskMapping = o.DiskMapping
   141  	result.NetworkAgent = o.NetworkAgent
   142  	result.Ntp = o.Ntp
   143  	result.HttpProxy = o.HttpProxy
   144  	result.HttpsProxy = o.HttpsProxy
   145  	result.NoProxy = o.NoProxy
   146  	return result
   147  }
   148  
   149  func (o *OsImageProfile) CloneRaw() gotenobject.GotenObjectExt {
   150  	return o.Clone()
   151  }
   152  
   153  func (o *OsImageProfile) Merge(source *OsImageProfile) {
   154  	if source.GetName() != nil {
   155  		if data, err := source.GetName().ProtoString(); err != nil {
   156  			panic(err)
   157  		} else {
   158  			o.Name = &Name{}
   159  			if err := o.Name.ParseProtoString(data); err != nil {
   160  				panic(err)
   161  			}
   162  		}
   163  	} else {
   164  		o.Name = nil
   165  	}
   166  	if source.GetMetadata() != nil {
   167  		if o.Metadata == nil {
   168  			o.Metadata = new(meta.Meta)
   169  		}
   170  		o.Metadata.Merge(source.GetMetadata())
   171  	}
   172  	o.DisplayName = source.GetDisplayName()
   173  	if source.GetDeviceType() != nil {
   174  		if data, err := source.GetDeviceType().ProtoString(); err != nil {
   175  			panic(err)
   176  		} else {
   177  			o.DeviceType = &device_type.Reference{}
   178  			if err := o.DeviceType.ParseProtoString(data); err != nil {
   179  				panic(err)
   180  			}
   181  		}
   182  	} else {
   183  		o.DeviceType = nil
   184  	}
   185  	o.InstallAiAccelerator = source.GetInstallAiAccelerator()
   186  	o.Encryption = source.GetEncryption()
   187  	o.DiskMapping = source.GetDiskMapping()
   188  	o.NetworkAgent = source.GetNetworkAgent()
   189  	o.Ntp = source.GetNtp()
   190  	o.HttpProxy = source.GetHttpProxy()
   191  	o.HttpsProxy = source.GetHttpsProxy()
   192  	o.NoProxy = source.GetNoProxy()
   193  }
   194  
   195  func (o *OsImageProfile) MergeRaw(source gotenobject.GotenObjectExt) {
   196  	o.Merge(source.(*OsImageProfile))
   197  }