forked from Dynatrace/dynatrace-configuration-as-code-core
/
api_one_agent_on_a_host.go
805 lines (702 loc) · 37.5 KB
/
api_one_agent_on_a_host.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
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
/*
Dynatrace Environment API
Documentation of the Dynatrace Environment API v1. To read about use cases and examples, see [Dynatrace Documentation](https://dt-url.net/xc03k3c). Notes about compatibility: * Operations marked as early adopter or preview may be changed in non-compatible ways, although we try to avoid this. * We may add new enum constants without incrementing the API version; thus, clients need to handle unknown enum constants gracefully.
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package environment
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"reflect"
)
type OneAgentOnAHostAPI interface {
/*
DeleteAgentPersistedPotentialProblems Deletes all detected auto-update blocking problems for this environment. | maturity=EARLY_ADOPTER
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiDeleteAgentPersistedPotentialProblemsRequest
*/
DeleteAgentPersistedPotentialProblems(ctx context.Context) ApiDeleteAgentPersistedPotentialProblemsRequest
// DeleteAgentPersistedPotentialProblemsExecute executes the request
DeleteAgentPersistedPotentialProblemsExecute(r ApiDeleteAgentPersistedPotentialProblemsRequest) (*http.Response, error)
/*
GetAgentPersistedPotentialProblems Gets a list of cluster-side detected auto-update problems that may block further rollout of a OneAgent version on a particular OS. | maturity=EARLY_ADOPTER
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetAgentPersistedPotentialProblemsRequest
*/
GetAgentPersistedPotentialProblems(ctx context.Context) ApiGetAgentPersistedPotentialProblemsRequest
// GetAgentPersistedPotentialProblemsExecute executes the request
// @return AgentPotentialProblemsState
GetAgentPersistedPotentialProblemsExecute(r ApiGetAgentPersistedPotentialProblemsRequest) (*AgentPotentialProblemsState, *http.Response, error)
/*
GetHostsWithSpecificAgents Gets the list of hosts with OneAgent deployment information for each host
You can narrow down the output by specifying filtering parameters for the request.
The response is limited to 500 items. Use the **nextPageKey** cursor to obtain subsequent results.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetHostsWithSpecificAgentsRequest
*/
GetHostsWithSpecificAgents(ctx context.Context) ApiGetHostsWithSpecificAgentsRequest
// GetHostsWithSpecificAgentsExecute executes the request
// @return HostsListPage
GetHostsWithSpecificAgentsExecute(r ApiGetHostsWithSpecificAgentsRequest) (*HostsListPage, *http.Response, error)
}
// OneAgentOnAHostAPIService OneAgentOnAHostAPI service
type OneAgentOnAHostAPIService service
type ApiDeleteAgentPersistedPotentialProblemsRequest struct {
ctx context.Context
ApiService OneAgentOnAHostAPI
}
func (r ApiDeleteAgentPersistedPotentialProblemsRequest) Execute() (*http.Response, error) {
return r.ApiService.DeleteAgentPersistedPotentialProblemsExecute(r)
}
/*
DeleteAgentPersistedPotentialProblems Deletes all detected auto-update blocking problems for this environment. | maturity=EARLY_ADOPTER
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiDeleteAgentPersistedPotentialProblemsRequest
*/
func (a *OneAgentOnAHostAPIService) DeleteAgentPersistedPotentialProblems(ctx context.Context) ApiDeleteAgentPersistedPotentialProblemsRequest {
return ApiDeleteAgentPersistedPotentialProblemsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *OneAgentOnAHostAPIService) DeleteAgentPersistedPotentialProblemsExecute(r ApiDeleteAgentPersistedPotentialProblemsRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OneAgentOnAHostAPIService.DeleteAgentPersistedPotentialProblems")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/oneagents/autoUpdateProblems"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["Api-Token"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["Authorization"] = key
}
}
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode >= 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiGetAgentPersistedPotentialProblemsRequest struct {
ctx context.Context
ApiService OneAgentOnAHostAPI
}
func (r ApiGetAgentPersistedPotentialProblemsRequest) Execute() (*AgentPotentialProblemsState, *http.Response, error) {
return r.ApiService.GetAgentPersistedPotentialProblemsExecute(r)
}
/*
GetAgentPersistedPotentialProblems Gets a list of cluster-side detected auto-update problems that may block further rollout of a OneAgent version on a particular OS. | maturity=EARLY_ADOPTER
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetAgentPersistedPotentialProblemsRequest
*/
func (a *OneAgentOnAHostAPIService) GetAgentPersistedPotentialProblems(ctx context.Context) ApiGetAgentPersistedPotentialProblemsRequest {
return ApiGetAgentPersistedPotentialProblemsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return AgentPotentialProblemsState
func (a *OneAgentOnAHostAPIService) GetAgentPersistedPotentialProblemsExecute(r ApiGetAgentPersistedPotentialProblemsRequest) (*AgentPotentialProblemsState, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *AgentPotentialProblemsState
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OneAgentOnAHostAPIService.GetAgentPersistedPotentialProblems")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/oneagents/autoUpdateProblems"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json; charset=utf-8", "application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["Api-Token"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["Authorization"] = key
}
}
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode >= 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetHostsWithSpecificAgentsRequest struct {
ctx context.Context
ApiService OneAgentOnAHostAPI
includeDetails *bool
startTimestamp *int64
endTimestamp *int64
relativeTime *string
tag *[]string
entity *[]string
managementZoneId *int64
managementZone *string
networkZoneId *string
hostGroupId *string
hostGroupName *string
osType *string
cloudType *string
autoInjection *string
availabilityState *string
detailedAvailabilityState *string
monitoringType *string
agentVersionIs *string
agentVersionNumber *string
autoUpdateSetting *string
updateStatus *string
faultyVersion *bool
unlicensed *bool
activeGateId *string
technologyModuleType *string
technologyModuleVersionIs *string
technologyModuleVersionNumber *string
technologyModuleFaultyVersion *bool
pluginName *string
pluginVersionIs *string
pluginVersionNumber *string
pluginState *string
nextPageKey *string
}
// Includes (`true`) or excludes (`false`) details which are queried from related entities. Excluding details may make queries faster. If not set, then `true` is used.
func (r ApiGetHostsWithSpecificAgentsRequest) IncludeDetails(includeDetails bool) ApiGetHostsWithSpecificAgentsRequest {
r.includeDetails = &includeDetails
return r
}
// The start timestamp of the requested timeframe, in milliseconds (UTC). If not set, then 72 hours behind from now is used.
func (r ApiGetHostsWithSpecificAgentsRequest) StartTimestamp(startTimestamp int64) ApiGetHostsWithSpecificAgentsRequest {
r.startTimestamp = &startTimestamp
return r
}
// The end timestamp of the requested timeframe, in milliseconds (UTC). If not set, then the current timestamp is used. The timeframe must not exceed 7 months (214 days).
func (r ApiGetHostsWithSpecificAgentsRequest) EndTimestamp(endTimestamp int64) ApiGetHostsWithSpecificAgentsRequest {
r.endTimestamp = &endTimestamp
return r
}
// The relative timeframe, back from now. If you need to specify relative timeframe that is not presented in the list of possible values, specify the **startTimestamp** (up to 214 days back from now) and leave **endTimestamp** and **relativeTime** empty.
func (r ApiGetHostsWithSpecificAgentsRequest) RelativeTime(relativeTime string) ApiGetHostsWithSpecificAgentsRequest {
r.relativeTime = &relativeTime
return r
}
// Filters the resulting set of hosts by the specified tag. You can specify several tags in the following format: `tag=tag1&tag=tag2`. The host has to match **all** the specified tags. In case of key-value tags, such as imported AWS or CloudFoundry tags, use the following format: `tag=[context]key:value`. For custom key-value tags, omit the context: `tag=key:value`.
func (r ApiGetHostsWithSpecificAgentsRequest) Tag(tag []string) ApiGetHostsWithSpecificAgentsRequest {
r.tag = &tag
return r
}
// Filters result to the specified hosts only. To specify several hosts use the following format: `entity=ID1&entity=ID2`.
func (r ApiGetHostsWithSpecificAgentsRequest) Entity(entity []string) ApiGetHostsWithSpecificAgentsRequest {
r.entity = &entity
return r
}
// Only return hosts that are part of the specified management zone. Specify the management zone ID here.
func (r ApiGetHostsWithSpecificAgentsRequest) ManagementZoneId(managementZoneId int64) ApiGetHostsWithSpecificAgentsRequest {
r.managementZoneId = &managementZoneId
return r
}
// Only return hosts that are part of the specified management zone. Specify the management zone name here. If the **managementZoneId** parameter is set, this parameter is ignored.
func (r ApiGetHostsWithSpecificAgentsRequest) ManagementZone(managementZone string) ApiGetHostsWithSpecificAgentsRequest {
r.managementZone = &managementZone
return r
}
// Filters the resulting set of hosts by the specified network zone. Specify the Dynatrace entity ID of the required network zone. You can fetch the list of available network zones with the [GET all network zones](https://dt-url.net/u4o3r7z) call.
func (r ApiGetHostsWithSpecificAgentsRequest) NetworkZoneId(networkZoneId string) ApiGetHostsWithSpecificAgentsRequest {
r.networkZoneId = &networkZoneId
return r
}
// Filters the resulting set of hosts by the specified host group. Specify the Dynatrace entity ID of the required host group.
func (r ApiGetHostsWithSpecificAgentsRequest) HostGroupId(hostGroupId string) ApiGetHostsWithSpecificAgentsRequest {
r.hostGroupId = &hostGroupId
return r
}
// Filters the resulting set of hosts by the specified host group. Specify the name of the required host group.
func (r ApiGetHostsWithSpecificAgentsRequest) HostGroupName(hostGroupName string) ApiGetHostsWithSpecificAgentsRequest {
r.hostGroupName = &hostGroupName
return r
}
// Filters the resulting set of hosts by the OS type.
func (r ApiGetHostsWithSpecificAgentsRequest) OsType(osType string) ApiGetHostsWithSpecificAgentsRequest {
r.osType = &osType
return r
}
// Filters the resulting set of hosts by the cloud type.
func (r ApiGetHostsWithSpecificAgentsRequest) CloudType(cloudType string) ApiGetHostsWithSpecificAgentsRequest {
r.cloudType = &cloudType
return r
}
// Filters the resulting set of hosts by the auto-injection status.
func (r ApiGetHostsWithSpecificAgentsRequest) AutoInjection(autoInjection string) ApiGetHostsWithSpecificAgentsRequest {
r.autoInjection = &autoInjection
return r
}
// Filters the resulting set of hosts by the availability state of OneAgent. * `MONITORED`: Hosts where OneAgent is enabled and active. * `UNMONITORED`: Hosts where OneAgent is disabled and inactive. * `CRASHED`: Hosts where OneAgent has returned a crash status code. * `LOST`: Hosts where it is impossible to establish connection with OneAgent. * `PRE_MONITORED`: Hosts where OneAgent is being initialized for monitoring. * `SHUTDOWN`: Hosts where OneAgent is shutting down in a controlled process. * `UNEXPECTED_SHUTDOWN`: Hosts where OneAgent is shutting down in an uncontrolled process. * `UNKNOWN`: Hosts where the state of OneAgent is unknown.
func (r ApiGetHostsWithSpecificAgentsRequest) AvailabilityState(availabilityState string) ApiGetHostsWithSpecificAgentsRequest {
r.availabilityState = &availabilityState
return r
}
// Filters the resulting set of hosts by the detailed availability state of OneAgent. * `UNKNOWN`: Hosts where the state of OneAgent is unknown. * `PRE_MONITORED`: Hosts where OneAgent is being initialized for monitoring. * `CRASHED_UNKNOWN`: Hosts where OneAgent has crashed for unknown reason. * `CRASHED_FAILURE`: Hosts where OneAgent has returned a crash status code. * `LOST_UNKNOWN`: Hosts where it is impossible to establish connection with OneAgent for unknown reason. * `LOST_CONNECTION`: Hosts where OneAgent has been recognized to be inactive. * `LOST_AGENT_UPGRADE_FAILED`: Hosts where OneAgent has a potential update problem due to inactivity after update. * `SHUTDOWN_UNKNOWN_UNEXPECTED`: Hosts where OneAgent is shutting down in an uncontrolled process. * `SHUTDOWN_UNKNOWN`: Hosts where OneAgent has shutdown for unknown reason. * `SHUTDOWN_GRACEFUL`: Hosts where OneAgent has shutdown because of host shutdown. * `SHUTDOWN_STOPPED`: Hosts where OneAgent has shutdown because the host has stopped. * `SHUTDOWN_AGENT_LOST`: Hosts where PaaS module has been recognized to be inactive. * `SHUTDOWN_SPOT_INSTANCE`: Hosts where OneAgent shutdown was triggered by the AWS Spot Instance interruption. * `UNMONITORED_UNKNOWN`: Hosts where OneAgent is disabled and inactive for unknown reason. * `UNMONITORED_TERMINATED`: Hosts where OneAgent has terminated. * `UNMONITORED_DISABLED`: Hosts where OneAgent has been disabled in configuration. * `UNMONITORED_AGENT_STOPPED`: Hosts where OneAgent is stopped. * `UNMONITORED_AGENT_RESTART_TRIGGERED`: Hosts where OneAgent is being restarted. * `UNMONITORED_AGENT_UNINSTALLED`: Hosts where OneAgent is uninstalled. * `UNMONITORED_AGENT_DISABLED`: Hosts where OneAgent reported that it was disabled. * `UNMONITORED_AGENT_UPGRADE_FAILED`: Hosts where OneAgent has a potential update problem. * `UNMONITORED_ID_CHANGED`: Hosts where OneAgent has potentially changed ID during update. * `UNMONITORED_AGENT_LOST`: Hosts where OneAgent has been recognized to be unavailable due to server communication issues. * `UNMONITORED_AGENT_UNREGISTERED`: Hosts where a code module has been recognized to be unavailable because of shutdown. * `UNMONITORED_AGENT_VERSION_REJECTED`: Hosts where OneAgent was rejected because the version does not meet the minimum agent version requirement. * `MONITORED`: Hosts where OneAgent is enabled and active. * `MONITORED_ENABLED`: Hosts where OneAgent has been enabled in configuration. * `MONITORED_AGENT_REGISTERED`: Hosts where the new OneAgent has been recognized. * `MONITORED_AGENT_UPGRADE_STARTED`: Hosts where OneAgent has shutdown due to an update. * `MONITORED_AGENT_ENABLED`: Hosts where OneAgent reported that it was enabled. * `MONITORED_AGENT_VERSION_ACCEPTED`: Hosts where OneAgent was accepted because the version meets the minimum agent version requirement.
func (r ApiGetHostsWithSpecificAgentsRequest) DetailedAvailabilityState(detailedAvailabilityState string) ApiGetHostsWithSpecificAgentsRequest {
r.detailedAvailabilityState = &detailedAvailabilityState
return r
}
// Filters the resulting set of hosts by monitoring mode of OneAgent deployed on the host.
func (r ApiGetHostsWithSpecificAgentsRequest) MonitoringType(monitoringType string) ApiGetHostsWithSpecificAgentsRequest {
r.monitoringType = &monitoringType
return r
}
// Filters the resulting set of hosts to those that have a certain OneAgent version deployed on the host. Specify the comparison operator here.
func (r ApiGetHostsWithSpecificAgentsRequest) AgentVersionIs(agentVersionIs string) ApiGetHostsWithSpecificAgentsRequest {
r.agentVersionIs = &agentVersionIs
return r
}
// Filters the resulting set of hosts to those that have a certain OneAgent version deployed on the host. Specify the version in the `<major>.<minor>.<revision>` format, for example `1.182.0`. You can fetch the list of available versions with the [GET available versions](https://dt-url.net/fo23rb5) call.
func (r ApiGetHostsWithSpecificAgentsRequest) AgentVersionNumber(agentVersionNumber string) ApiGetHostsWithSpecificAgentsRequest {
r.agentVersionNumber = &agentVersionNumber
return r
}
// Filters the resulting set of hosts by the actual state of the auto-update setting of deployed OneAgents.
func (r ApiGetHostsWithSpecificAgentsRequest) AutoUpdateSetting(autoUpdateSetting string) ApiGetHostsWithSpecificAgentsRequest {
r.autoUpdateSetting = &autoUpdateSetting
return r
}
// Filters the resulting set of hosts by the update status of OneAgent deployed on the host.
func (r ApiGetHostsWithSpecificAgentsRequest) UpdateStatus(updateStatus string) ApiGetHostsWithSpecificAgentsRequest {
r.updateStatus = &updateStatus
return r
}
// Filters the resulting set of hosts to those that run OneAgent version that is marked as faulty.
func (r ApiGetHostsWithSpecificAgentsRequest) FaultyVersion(faultyVersion bool) ApiGetHostsWithSpecificAgentsRequest {
r.faultyVersion = &faultyVersion
return r
}
// Filters the resulting set of hosts to those that run OneAgent that are unlicensed. Example: Discovery Mode is currently only available on Dynatrace SaaS with DPS capability \"Foundation & Discovery\".
func (r ApiGetHostsWithSpecificAgentsRequest) Unlicensed(unlicensed bool) ApiGetHostsWithSpecificAgentsRequest {
r.unlicensed = &unlicensed
return r
}
// Filters the resulting set of hosts to those that are currently connected to the ActiveGate with the specified ID. Use **DIRECT_COMMUNICATION** keyword to find the hosts not connected to any ActiveGate.
func (r ApiGetHostsWithSpecificAgentsRequest) ActiveGateId(activeGateId string) ApiGetHostsWithSpecificAgentsRequest {
r.activeGateId = &activeGateId
return r
}
// Filters the resulting set of hosts to those that run the specified OneAgent code module. If several code module filters are specified, the code module has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) TechnologyModuleType(technologyModuleType string) ApiGetHostsWithSpecificAgentsRequest {
r.technologyModuleType = &technologyModuleType
return r
}
// Filters the resulting set of hosts to those that have a certain code module version deployed on the host. Specify the comparison operator here. If several code module filters are specified, the code module has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) TechnologyModuleVersionIs(technologyModuleVersionIs string) ApiGetHostsWithSpecificAgentsRequest {
r.technologyModuleVersionIs = &technologyModuleVersionIs
return r
}
// Filters the resulting set of hosts to those that have a certain code module version deployed on the host. Specify the version in the `<major>.<minor>.<revision>` format, for example `1.182.0`. You can fetch the list of available versions with the [GET available versions](https://dt-url.net/fo23rb5) call. If several code module filters are specified, the code module has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) TechnologyModuleVersionNumber(technologyModuleVersionNumber string) ApiGetHostsWithSpecificAgentsRequest {
r.technologyModuleVersionNumber = &technologyModuleVersionNumber
return r
}
// Filters the resulting set of hosts to those that run the code module version that is marked as faulty. If several code module filters are specified, the code module has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) TechnologyModuleFaultyVersion(technologyModuleFaultyVersion bool) ApiGetHostsWithSpecificAgentsRequest {
r.technologyModuleFaultyVersion = &technologyModuleFaultyVersion
return r
}
// Filters the resulting set of hosts to those that run the plugin with the specified name. The **CONTAINS** operator is applied to the specified value. If several plugin filters are specified, the plugin has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) PluginName(pluginName string) ApiGetHostsWithSpecificAgentsRequest {
r.pluginName = &pluginName
return r
}
// Filters the resulting set of hosts to those that have a certain plugin version deployed on the host. Specify the comparison operator here. If several plugin filters are specified, the plugin has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) PluginVersionIs(pluginVersionIs string) ApiGetHostsWithSpecificAgentsRequest {
r.pluginVersionIs = &pluginVersionIs
return r
}
// Filters the resulting set of hosts to those that have a certain plugin version deployed on the host. Specify the version in the `<major>.<minor>.<revision>` format, for example `1.182.0`. You can fetch the list of available versions with the [GET available versions](https://dt-url.net/fo23rb5) call. `<minor>` and `<revision>` parts of the version number are optional. If several plugin filters are specified, the plugin has to match **all** the filters.
func (r ApiGetHostsWithSpecificAgentsRequest) PluginVersionNumber(pluginVersionNumber string) ApiGetHostsWithSpecificAgentsRequest {
r.pluginVersionNumber = &pluginVersionNumber
return r
}
// Filters the resulting set of hosts to those that run the plugin with the specified state.
func (r ApiGetHostsWithSpecificAgentsRequest) PluginState(pluginState string) ApiGetHostsWithSpecificAgentsRequest {
r.pluginState = &pluginState
return r
}
// The cursor for the next page of results, if results do not fit on one page. You can find the cursor value on the current page of the response, in the **nextPageKey** field. To obtain subsequent pages, you must specify this cursor value in your query, and keep all other query parameters as they were in the original request. If you don't specify the cursor, the first page will always be returned.
func (r ApiGetHostsWithSpecificAgentsRequest) NextPageKey(nextPageKey string) ApiGetHostsWithSpecificAgentsRequest {
r.nextPageKey = &nextPageKey
return r
}
func (r ApiGetHostsWithSpecificAgentsRequest) Execute() (*HostsListPage, *http.Response, error) {
return r.ApiService.GetHostsWithSpecificAgentsExecute(r)
}
/*
GetHostsWithSpecificAgents Gets the list of hosts with OneAgent deployment information for each host
You can narrow down the output by specifying filtering parameters for the request.
The response is limited to 500 items. Use the **nextPageKey** cursor to obtain subsequent results.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetHostsWithSpecificAgentsRequest
*/
func (a *OneAgentOnAHostAPIService) GetHostsWithSpecificAgents(ctx context.Context) ApiGetHostsWithSpecificAgentsRequest {
return ApiGetHostsWithSpecificAgentsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return HostsListPage
func (a *OneAgentOnAHostAPIService) GetHostsWithSpecificAgentsExecute(r ApiGetHostsWithSpecificAgentsRequest) (*HostsListPage, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *HostsListPage
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OneAgentOnAHostAPIService.GetHostsWithSpecificAgents")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/oneagents"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.includeDetails != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeDetails", r.includeDetails, "")
} else {
var defaultValue bool = true
r.includeDetails = &defaultValue
}
if r.startTimestamp != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startTimestamp", r.startTimestamp, "")
}
if r.endTimestamp != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endTimestamp", r.endTimestamp, "")
}
if r.relativeTime != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "relativeTime", r.relativeTime, "")
}
if r.tag != nil {
t := *r.tag
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
parameterAddToHeaderOrQuery(localVarQueryParams, "tag", s.Index(i).Interface(), "multi")
}
} else {
parameterAddToHeaderOrQuery(localVarQueryParams, "tag", t, "multi")
}
}
if r.entity != nil {
t := *r.entity
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
parameterAddToHeaderOrQuery(localVarQueryParams, "entity", s.Index(i).Interface(), "multi")
}
} else {
parameterAddToHeaderOrQuery(localVarQueryParams, "entity", t, "multi")
}
}
if r.managementZoneId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "managementZoneId", r.managementZoneId, "")
}
if r.managementZone != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "managementZone", r.managementZone, "")
}
if r.networkZoneId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "networkZoneId", r.networkZoneId, "")
}
if r.hostGroupId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hostGroupId", r.hostGroupId, "")
}
if r.hostGroupName != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hostGroupName", r.hostGroupName, "")
}
if r.osType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "")
}
if r.cloudType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "cloudType", r.cloudType, "")
}
if r.autoInjection != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "autoInjection", r.autoInjection, "")
}
if r.availabilityState != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "availabilityState", r.availabilityState, "")
}
if r.detailedAvailabilityState != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "detailedAvailabilityState", r.detailedAvailabilityState, "")
}
if r.monitoringType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "monitoringType", r.monitoringType, "")
}
if r.agentVersionIs != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "agentVersionIs", r.agentVersionIs, "")
}
if r.agentVersionNumber != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "agentVersionNumber", r.agentVersionNumber, "")
}
if r.autoUpdateSetting != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "autoUpdateSetting", r.autoUpdateSetting, "")
}
if r.updateStatus != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updateStatus", r.updateStatus, "")
}
if r.faultyVersion != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "faultyVersion", r.faultyVersion, "")
}
if r.unlicensed != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "unlicensed", r.unlicensed, "")
}
if r.activeGateId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "activeGateId", r.activeGateId, "")
}
if r.technologyModuleType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "technologyModuleType", r.technologyModuleType, "")
}
if r.technologyModuleVersionIs != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "technologyModuleVersionIs", r.technologyModuleVersionIs, "")
}
if r.technologyModuleVersionNumber != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "technologyModuleVersionNumber", r.technologyModuleVersionNumber, "")
}
if r.technologyModuleFaultyVersion != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "technologyModuleFaultyVersion", r.technologyModuleFaultyVersion, "")
}
if r.pluginName != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pluginName", r.pluginName, "")
}
if r.pluginVersionIs != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pluginVersionIs", r.pluginVersionIs, "")
}
if r.pluginVersionNumber != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pluginVersionNumber", r.pluginVersionNumber, "")
}
if r.pluginState != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pluginState", r.pluginState, "")
}
if r.nextPageKey != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageKey", r.nextPageKey, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json; charset=utf-8", "application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["Api-Token"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["Authorization"] = key
}
}
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode >= 500 {
var v ErrorEnvelope
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}