-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent.go
671 lines (623 loc) · 24.6 KB
/
agent.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/open-uem/ent/agent"
"github.com/open-uem/ent/antivirus"
"github.com/open-uem/ent/computer"
"github.com/open-uem/ent/operatingsystem"
"github.com/open-uem/ent/release"
"github.com/open-uem/ent/systemupdate"
)
// Agent is the model entity for the Agent schema.
type Agent struct {
config `json:"-"`
// ID of the ent.
ID string `json:"id,omitempty"`
// Os holds the value of the "os" field.
Os string `json:"os,omitempty"`
// Hostname holds the value of the "hostname" field.
Hostname string `json:"hostname,omitempty"`
// IP holds the value of the "ip" field.
IP string `json:"ip,omitempty"`
// MAC holds the value of the "mac" field.
MAC string `json:"mac,omitempty"`
// FirstContact holds the value of the "first_contact" field.
FirstContact time.Time `json:"first_contact,omitempty"`
// LastContact holds the value of the "last_contact" field.
LastContact time.Time `json:"last_contact,omitempty"`
// Vnc holds the value of the "vnc" field.
Vnc string `json:"vnc,omitempty"`
// Notes holds the value of the "notes" field.
Notes string `json:"notes,omitempty"`
// UpdateTaskStatus holds the value of the "update_task_status" field.
UpdateTaskStatus string `json:"update_task_status,omitempty"`
// UpdateTaskDescription holds the value of the "update_task_description" field.
UpdateTaskDescription string `json:"update_task_description,omitempty"`
// UpdateTaskResult holds the value of the "update_task_result" field.
UpdateTaskResult string `json:"update_task_result,omitempty"`
// UpdateTaskExecution holds the value of the "update_task_execution" field.
UpdateTaskExecution time.Time `json:"update_task_execution,omitempty"`
// UpdateTaskVersion holds the value of the "update_task_version" field.
UpdateTaskVersion string `json:"update_task_version,omitempty"`
// VncProxyPort holds the value of the "vnc_proxy_port" field.
VncProxyPort string `json:"vnc_proxy_port,omitempty"`
// SftpPort holds the value of the "sftp_port" field.
SftpPort string `json:"sftp_port,omitempty"`
// AgentStatus holds the value of the "agent_status" field.
AgentStatus agent.AgentStatus `json:"agent_status,omitempty"`
// CertificateReady holds the value of the "certificate_ready" field.
CertificateReady bool `json:"certificate_ready,omitempty"`
// RestartRequired holds the value of the "restart_required" field.
RestartRequired bool `json:"restart_required,omitempty"`
// IsRemote holds the value of the "is_remote" field.
IsRemote bool `json:"is_remote,omitempty"`
// DebugMode holds the value of the "debug_mode" field.
DebugMode bool `json:"debug_mode,omitempty"`
// SftpService holds the value of the "sftp_service" field.
SftpService bool `json:"sftp_service,omitempty"`
// RemoteAssistance holds the value of the "remote_assistance" field.
RemoteAssistance bool `json:"remote_assistance,omitempty"`
// SettingsModified holds the value of the "settings_modified" field.
SettingsModified time.Time `json:"settings_modified,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the AgentQuery when eager-loading is set.
Edges AgentEdges `json:"edges"`
release_agents *int
selectValues sql.SelectValues
}
// AgentEdges holds the relations/edges for other nodes in the graph.
type AgentEdges struct {
// Computer holds the value of the computer edge.
Computer *Computer `json:"computer,omitempty"`
// Operatingsystem holds the value of the operatingsystem edge.
Operatingsystem *OperatingSystem `json:"operatingsystem,omitempty"`
// Systemupdate holds the value of the systemupdate edge.
Systemupdate *SystemUpdate `json:"systemupdate,omitempty"`
// Antivirus holds the value of the antivirus edge.
Antivirus *Antivirus `json:"antivirus,omitempty"`
// Logicaldisks holds the value of the logicaldisks edge.
Logicaldisks []*LogicalDisk `json:"logicaldisks,omitempty"`
// Apps holds the value of the apps edge.
Apps []*App `json:"apps,omitempty"`
// Monitors holds the value of the monitors edge.
Monitors []*Monitor `json:"monitors,omitempty"`
// Shares holds the value of the shares edge.
Shares []*Share `json:"shares,omitempty"`
// Printers holds the value of the printers edge.
Printers []*Printer `json:"printers,omitempty"`
// Networkadapters holds the value of the networkadapters edge.
Networkadapters []*NetworkAdapter `json:"networkadapters,omitempty"`
// Deployments holds the value of the deployments edge.
Deployments []*Deployment `json:"deployments,omitempty"`
// Updates holds the value of the updates edge.
Updates []*Update `json:"updates,omitempty"`
// Tags holds the value of the tags edge.
Tags []*Tag `json:"tags,omitempty"`
// Metadata holds the value of the metadata edge.
Metadata []*Metadata `json:"metadata,omitempty"`
// Wingetcfgexclusions holds the value of the wingetcfgexclusions edge.
Wingetcfgexclusions []*WingetConfigExclusion `json:"wingetcfgexclusions,omitempty"`
// Memoryslots holds the value of the memoryslots edge.
Memoryslots []*MemorySlot `json:"memoryslots,omitempty"`
// Release holds the value of the release edge.
Release *Release `json:"release,omitempty"`
// Profileissue holds the value of the profileissue edge.
Profileissue []*ProfileIssue `json:"profileissue,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [18]bool
}
// ComputerOrErr returns the Computer value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e AgentEdges) ComputerOrErr() (*Computer, error) {
if e.Computer != nil {
return e.Computer, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: computer.Label}
}
return nil, &NotLoadedError{edge: "computer"}
}
// OperatingsystemOrErr returns the Operatingsystem value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e AgentEdges) OperatingsystemOrErr() (*OperatingSystem, error) {
if e.Operatingsystem != nil {
return e.Operatingsystem, nil
} else if e.loadedTypes[1] {
return nil, &NotFoundError{label: operatingsystem.Label}
}
return nil, &NotLoadedError{edge: "operatingsystem"}
}
// SystemupdateOrErr returns the Systemupdate value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e AgentEdges) SystemupdateOrErr() (*SystemUpdate, error) {
if e.Systemupdate != nil {
return e.Systemupdate, nil
} else if e.loadedTypes[2] {
return nil, &NotFoundError{label: systemupdate.Label}
}
return nil, &NotLoadedError{edge: "systemupdate"}
}
// AntivirusOrErr returns the Antivirus value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e AgentEdges) AntivirusOrErr() (*Antivirus, error) {
if e.Antivirus != nil {
return e.Antivirus, nil
} else if e.loadedTypes[3] {
return nil, &NotFoundError{label: antivirus.Label}
}
return nil, &NotLoadedError{edge: "antivirus"}
}
// LogicaldisksOrErr returns the Logicaldisks value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) LogicaldisksOrErr() ([]*LogicalDisk, error) {
if e.loadedTypes[4] {
return e.Logicaldisks, nil
}
return nil, &NotLoadedError{edge: "logicaldisks"}
}
// AppsOrErr returns the Apps value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) AppsOrErr() ([]*App, error) {
if e.loadedTypes[5] {
return e.Apps, nil
}
return nil, &NotLoadedError{edge: "apps"}
}
// MonitorsOrErr returns the Monitors value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) MonitorsOrErr() ([]*Monitor, error) {
if e.loadedTypes[6] {
return e.Monitors, nil
}
return nil, &NotLoadedError{edge: "monitors"}
}
// SharesOrErr returns the Shares value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) SharesOrErr() ([]*Share, error) {
if e.loadedTypes[7] {
return e.Shares, nil
}
return nil, &NotLoadedError{edge: "shares"}
}
// PrintersOrErr returns the Printers value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) PrintersOrErr() ([]*Printer, error) {
if e.loadedTypes[8] {
return e.Printers, nil
}
return nil, &NotLoadedError{edge: "printers"}
}
// NetworkadaptersOrErr returns the Networkadapters value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) NetworkadaptersOrErr() ([]*NetworkAdapter, error) {
if e.loadedTypes[9] {
return e.Networkadapters, nil
}
return nil, &NotLoadedError{edge: "networkadapters"}
}
// DeploymentsOrErr returns the Deployments value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) DeploymentsOrErr() ([]*Deployment, error) {
if e.loadedTypes[10] {
return e.Deployments, nil
}
return nil, &NotLoadedError{edge: "deployments"}
}
// UpdatesOrErr returns the Updates value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) UpdatesOrErr() ([]*Update, error) {
if e.loadedTypes[11] {
return e.Updates, nil
}
return nil, &NotLoadedError{edge: "updates"}
}
// TagsOrErr returns the Tags value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) TagsOrErr() ([]*Tag, error) {
if e.loadedTypes[12] {
return e.Tags, nil
}
return nil, &NotLoadedError{edge: "tags"}
}
// MetadataOrErr returns the Metadata value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) MetadataOrErr() ([]*Metadata, error) {
if e.loadedTypes[13] {
return e.Metadata, nil
}
return nil, &NotLoadedError{edge: "metadata"}
}
// WingetcfgexclusionsOrErr returns the Wingetcfgexclusions value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) WingetcfgexclusionsOrErr() ([]*WingetConfigExclusion, error) {
if e.loadedTypes[14] {
return e.Wingetcfgexclusions, nil
}
return nil, &NotLoadedError{edge: "wingetcfgexclusions"}
}
// MemoryslotsOrErr returns the Memoryslots value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) MemoryslotsOrErr() ([]*MemorySlot, error) {
if e.loadedTypes[15] {
return e.Memoryslots, nil
}
return nil, &NotLoadedError{edge: "memoryslots"}
}
// ReleaseOrErr returns the Release value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e AgentEdges) ReleaseOrErr() (*Release, error) {
if e.Release != nil {
return e.Release, nil
} else if e.loadedTypes[16] {
return nil, &NotFoundError{label: release.Label}
}
return nil, &NotLoadedError{edge: "release"}
}
// ProfileissueOrErr returns the Profileissue value or an error if the edge
// was not loaded in eager-loading.
func (e AgentEdges) ProfileissueOrErr() ([]*ProfileIssue, error) {
if e.loadedTypes[17] {
return e.Profileissue, nil
}
return nil, &NotLoadedError{edge: "profileissue"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Agent) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case agent.FieldCertificateReady, agent.FieldRestartRequired, agent.FieldIsRemote, agent.FieldDebugMode, agent.FieldSftpService, agent.FieldRemoteAssistance:
values[i] = new(sql.NullBool)
case agent.FieldID, agent.FieldOs, agent.FieldHostname, agent.FieldIP, agent.FieldMAC, agent.FieldVnc, agent.FieldNotes, agent.FieldUpdateTaskStatus, agent.FieldUpdateTaskDescription, agent.FieldUpdateTaskResult, agent.FieldUpdateTaskVersion, agent.FieldVncProxyPort, agent.FieldSftpPort, agent.FieldAgentStatus:
values[i] = new(sql.NullString)
case agent.FieldFirstContact, agent.FieldLastContact, agent.FieldUpdateTaskExecution, agent.FieldSettingsModified:
values[i] = new(sql.NullTime)
case agent.ForeignKeys[0]: // release_agents
values[i] = new(sql.NullInt64)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Agent fields.
func (a *Agent) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case agent.FieldID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value.Valid {
a.ID = value.String
}
case agent.FieldOs:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field os", values[i])
} else if value.Valid {
a.Os = value.String
}
case agent.FieldHostname:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field hostname", values[i])
} else if value.Valid {
a.Hostname = value.String
}
case agent.FieldIP:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field ip", values[i])
} else if value.Valid {
a.IP = value.String
}
case agent.FieldMAC:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field mac", values[i])
} else if value.Valid {
a.MAC = value.String
}
case agent.FieldFirstContact:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field first_contact", values[i])
} else if value.Valid {
a.FirstContact = value.Time
}
case agent.FieldLastContact:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field last_contact", values[i])
} else if value.Valid {
a.LastContact = value.Time
}
case agent.FieldVnc:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field vnc", values[i])
} else if value.Valid {
a.Vnc = value.String
}
case agent.FieldNotes:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field notes", values[i])
} else if value.Valid {
a.Notes = value.String
}
case agent.FieldUpdateTaskStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field update_task_status", values[i])
} else if value.Valid {
a.UpdateTaskStatus = value.String
}
case agent.FieldUpdateTaskDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field update_task_description", values[i])
} else if value.Valid {
a.UpdateTaskDescription = value.String
}
case agent.FieldUpdateTaskResult:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field update_task_result", values[i])
} else if value.Valid {
a.UpdateTaskResult = value.String
}
case agent.FieldUpdateTaskExecution:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field update_task_execution", values[i])
} else if value.Valid {
a.UpdateTaskExecution = value.Time
}
case agent.FieldUpdateTaskVersion:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field update_task_version", values[i])
} else if value.Valid {
a.UpdateTaskVersion = value.String
}
case agent.FieldVncProxyPort:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field vnc_proxy_port", values[i])
} else if value.Valid {
a.VncProxyPort = value.String
}
case agent.FieldSftpPort:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field sftp_port", values[i])
} else if value.Valid {
a.SftpPort = value.String
}
case agent.FieldAgentStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field agent_status", values[i])
} else if value.Valid {
a.AgentStatus = agent.AgentStatus(value.String)
}
case agent.FieldCertificateReady:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field certificate_ready", values[i])
} else if value.Valid {
a.CertificateReady = value.Bool
}
case agent.FieldRestartRequired:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field restart_required", values[i])
} else if value.Valid {
a.RestartRequired = value.Bool
}
case agent.FieldIsRemote:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field is_remote", values[i])
} else if value.Valid {
a.IsRemote = value.Bool
}
case agent.FieldDebugMode:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field debug_mode", values[i])
} else if value.Valid {
a.DebugMode = value.Bool
}
case agent.FieldSftpService:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field sftp_service", values[i])
} else if value.Valid {
a.SftpService = value.Bool
}
case agent.FieldRemoteAssistance:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field remote_assistance", values[i])
} else if value.Valid {
a.RemoteAssistance = value.Bool
}
case agent.FieldSettingsModified:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field settings_modified", values[i])
} else if value.Valid {
a.SettingsModified = value.Time
}
case agent.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for edge-field release_agents", value)
} else if value.Valid {
a.release_agents = new(int)
*a.release_agents = int(value.Int64)
}
default:
a.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Agent.
// This includes values selected through modifiers, order, etc.
func (a *Agent) Value(name string) (ent.Value, error) {
return a.selectValues.Get(name)
}
// QueryComputer queries the "computer" edge of the Agent entity.
func (a *Agent) QueryComputer() *ComputerQuery {
return NewAgentClient(a.config).QueryComputer(a)
}
// QueryOperatingsystem queries the "operatingsystem" edge of the Agent entity.
func (a *Agent) QueryOperatingsystem() *OperatingSystemQuery {
return NewAgentClient(a.config).QueryOperatingsystem(a)
}
// QuerySystemupdate queries the "systemupdate" edge of the Agent entity.
func (a *Agent) QuerySystemupdate() *SystemUpdateQuery {
return NewAgentClient(a.config).QuerySystemupdate(a)
}
// QueryAntivirus queries the "antivirus" edge of the Agent entity.
func (a *Agent) QueryAntivirus() *AntivirusQuery {
return NewAgentClient(a.config).QueryAntivirus(a)
}
// QueryLogicaldisks queries the "logicaldisks" edge of the Agent entity.
func (a *Agent) QueryLogicaldisks() *LogicalDiskQuery {
return NewAgentClient(a.config).QueryLogicaldisks(a)
}
// QueryApps queries the "apps" edge of the Agent entity.
func (a *Agent) QueryApps() *AppQuery {
return NewAgentClient(a.config).QueryApps(a)
}
// QueryMonitors queries the "monitors" edge of the Agent entity.
func (a *Agent) QueryMonitors() *MonitorQuery {
return NewAgentClient(a.config).QueryMonitors(a)
}
// QueryShares queries the "shares" edge of the Agent entity.
func (a *Agent) QueryShares() *ShareQuery {
return NewAgentClient(a.config).QueryShares(a)
}
// QueryPrinters queries the "printers" edge of the Agent entity.
func (a *Agent) QueryPrinters() *PrinterQuery {
return NewAgentClient(a.config).QueryPrinters(a)
}
// QueryNetworkadapters queries the "networkadapters" edge of the Agent entity.
func (a *Agent) QueryNetworkadapters() *NetworkAdapterQuery {
return NewAgentClient(a.config).QueryNetworkadapters(a)
}
// QueryDeployments queries the "deployments" edge of the Agent entity.
func (a *Agent) QueryDeployments() *DeploymentQuery {
return NewAgentClient(a.config).QueryDeployments(a)
}
// QueryUpdates queries the "updates" edge of the Agent entity.
func (a *Agent) QueryUpdates() *UpdateQuery {
return NewAgentClient(a.config).QueryUpdates(a)
}
// QueryTags queries the "tags" edge of the Agent entity.
func (a *Agent) QueryTags() *TagQuery {
return NewAgentClient(a.config).QueryTags(a)
}
// QueryMetadata queries the "metadata" edge of the Agent entity.
func (a *Agent) QueryMetadata() *MetadataQuery {
return NewAgentClient(a.config).QueryMetadata(a)
}
// QueryWingetcfgexclusions queries the "wingetcfgexclusions" edge of the Agent entity.
func (a *Agent) QueryWingetcfgexclusions() *WingetConfigExclusionQuery {
return NewAgentClient(a.config).QueryWingetcfgexclusions(a)
}
// QueryMemoryslots queries the "memoryslots" edge of the Agent entity.
func (a *Agent) QueryMemoryslots() *MemorySlotQuery {
return NewAgentClient(a.config).QueryMemoryslots(a)
}
// QueryRelease queries the "release" edge of the Agent entity.
func (a *Agent) QueryRelease() *ReleaseQuery {
return NewAgentClient(a.config).QueryRelease(a)
}
// QueryProfileissue queries the "profileissue" edge of the Agent entity.
func (a *Agent) QueryProfileissue() *ProfileIssueQuery {
return NewAgentClient(a.config).QueryProfileissue(a)
}
// Update returns a builder for updating this Agent.
// Note that you need to call Agent.Unwrap() before calling this method if this Agent
// was returned from a transaction, and the transaction was committed or rolled back.
func (a *Agent) Update() *AgentUpdateOne {
return NewAgentClient(a.config).UpdateOne(a)
}
// Unwrap unwraps the Agent entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (a *Agent) Unwrap() *Agent {
_tx, ok := a.config.driver.(*txDriver)
if !ok {
panic("ent: Agent is not a transactional entity")
}
a.config.driver = _tx.drv
return a
}
// String implements the fmt.Stringer.
func (a *Agent) String() string {
var builder strings.Builder
builder.WriteString("Agent(")
builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
builder.WriteString("os=")
builder.WriteString(a.Os)
builder.WriteString(", ")
builder.WriteString("hostname=")
builder.WriteString(a.Hostname)
builder.WriteString(", ")
builder.WriteString("ip=")
builder.WriteString(a.IP)
builder.WriteString(", ")
builder.WriteString("mac=")
builder.WriteString(a.MAC)
builder.WriteString(", ")
builder.WriteString("first_contact=")
builder.WriteString(a.FirstContact.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("last_contact=")
builder.WriteString(a.LastContact.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("vnc=")
builder.WriteString(a.Vnc)
builder.WriteString(", ")
builder.WriteString("notes=")
builder.WriteString(a.Notes)
builder.WriteString(", ")
builder.WriteString("update_task_status=")
builder.WriteString(a.UpdateTaskStatus)
builder.WriteString(", ")
builder.WriteString("update_task_description=")
builder.WriteString(a.UpdateTaskDescription)
builder.WriteString(", ")
builder.WriteString("update_task_result=")
builder.WriteString(a.UpdateTaskResult)
builder.WriteString(", ")
builder.WriteString("update_task_execution=")
builder.WriteString(a.UpdateTaskExecution.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("update_task_version=")
builder.WriteString(a.UpdateTaskVersion)
builder.WriteString(", ")
builder.WriteString("vnc_proxy_port=")
builder.WriteString(a.VncProxyPort)
builder.WriteString(", ")
builder.WriteString("sftp_port=")
builder.WriteString(a.SftpPort)
builder.WriteString(", ")
builder.WriteString("agent_status=")
builder.WriteString(fmt.Sprintf("%v", a.AgentStatus))
builder.WriteString(", ")
builder.WriteString("certificate_ready=")
builder.WriteString(fmt.Sprintf("%v", a.CertificateReady))
builder.WriteString(", ")
builder.WriteString("restart_required=")
builder.WriteString(fmt.Sprintf("%v", a.RestartRequired))
builder.WriteString(", ")
builder.WriteString("is_remote=")
builder.WriteString(fmt.Sprintf("%v", a.IsRemote))
builder.WriteString(", ")
builder.WriteString("debug_mode=")
builder.WriteString(fmt.Sprintf("%v", a.DebugMode))
builder.WriteString(", ")
builder.WriteString("sftp_service=")
builder.WriteString(fmt.Sprintf("%v", a.SftpService))
builder.WriteString(", ")
builder.WriteString("remote_assistance=")
builder.WriteString(fmt.Sprintf("%v", a.RemoteAssistance))
builder.WriteString(", ")
builder.WriteString("settings_modified=")
builder.WriteString(a.SettingsModified.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Agents is a parsable slice of Agent.
type Agents []*Agent