github.com/newrelic/newrelic-client-go@v1.1.0/pkg/workloads/types.go (about) 1 // Code generated by tutone: DO NOT EDIT 2 package workloads 3 4 import ( 5 "encoding/json" 6 "fmt" 7 8 "github.com/newrelic/newrelic-client-go/pkg/accounts" 9 "github.com/newrelic/newrelic-client-go/pkg/common" 10 "github.com/newrelic/newrelic-client-go/pkg/nrtime" 11 "github.com/newrelic/newrelic-client-go/pkg/users" 12 ) 13 14 // EntityCollectionType - Indicates where this collection is used 15 type EntityCollectionType string 16 17 var EntityCollectionTypeTypes = struct { 18 // Collections that define the entities that belong to a workload 19 WORKLOAD EntityCollectionType 20 // Collections that define the entity groups that are used to calculate the status of a workload 21 WORKLOAD_STATUS_RULE_GROUP EntityCollectionType 22 }{ 23 // Collections that define the entities that belong to a workload 24 WORKLOAD: "WORKLOAD", 25 // Collections that define the entity groups that are used to calculate the status of a workload 26 WORKLOAD_STATUS_RULE_GROUP: "WORKLOAD_STATUS_RULE_GROUP", 27 } 28 29 // WorkloadGroupRemainingEntitiesRuleBy - Indicates by which field the remaining entities rule should be grouped. 30 type WorkloadGroupRemainingEntitiesRuleBy string 31 32 var WorkloadGroupRemainingEntitiesRuleByTypes = struct { 33 // Group the remaining entities rule by entity type. 34 ENTITY_TYPE WorkloadGroupRemainingEntitiesRuleBy 35 // Do not apply any grouping to the remaining entities rule. 36 NONE WorkloadGroupRemainingEntitiesRuleBy 37 }{ 38 // Group the remaining entities rule by entity type. 39 ENTITY_TYPE: "ENTITY_TYPE", 40 // Do not apply any grouping to the remaining entities rule. 41 NONE: "NONE", 42 } 43 44 // WorkloadResultingGroupType - Represents the type of the rule that the resulting group of entities belongs to. 45 type WorkloadResultingGroupType string 46 47 var WorkloadResultingGroupTypeTypes = struct { 48 // The rule considers the entities within a specific group in the workload. 49 REGULAR_GROUP WorkloadResultingGroupType 50 // The rule considers all the entities within the workload that aren’t evaluated in any other rule. 51 REMAINING_ENTITIES WorkloadResultingGroupType 52 }{ 53 // The rule considers the entities within a specific group in the workload. 54 REGULAR_GROUP: "REGULAR_GROUP", 55 // The rule considers all the entities within the workload that aren’t evaluated in any other rule. 56 REMAINING_ENTITIES: "REMAINING_ENTITIES", 57 } 58 59 // WorkloadRollupStrategy - Represents the rollup strategy that is applied to a group of entities. 60 type WorkloadRollupStrategy string 61 62 var WorkloadRollupStrategyTypes = struct { 63 // The group status matches the less critical status of all belonging entities. 64 BEST_STATUS_WINS WorkloadRollupStrategy 65 // The group status matches the most critical status of all belonging entities. 66 WORST_STATUS_WINS WorkloadRollupStrategy 67 }{ 68 // The group status matches the less critical status of all belonging entities. 69 BEST_STATUS_WINS: "BEST_STATUS_WINS", 70 // The group status matches the most critical status of all belonging entities. 71 WORST_STATUS_WINS: "WORST_STATUS_WINS", 72 } 73 74 // WorkloadRuleThresholdType - Represents the type of the threshold defined for a rule. 75 type WorkloadRuleThresholdType string 76 77 var WorkloadRuleThresholdTypeTypes = struct { 78 // The worst status is rolled up only after a certain number of entities within the workload are not operational. 79 FIXED WorkloadRuleThresholdType 80 // The worst status is rolled up only after a certain percentage of entities within the workload are not operational. 81 PERCENTAGE WorkloadRuleThresholdType 82 }{ 83 // The worst status is rolled up only after a certain number of entities within the workload are not operational. 84 FIXED: "FIXED", 85 // The worst status is rolled up only after a certain percentage of entities within the workload are not operational. 86 PERCENTAGE: "PERCENTAGE", 87 } 88 89 // WorkloadStatusSource - Indicates where the status value derives from. 90 type WorkloadStatusSource string 91 92 var WorkloadStatusSourceTypes = struct { 93 // Refers to the result of an automatic rule defined for a workload. 94 ROLLUP_RULE WorkloadStatusSource 95 // Refers to a static status defined for a workload. 96 STATIC WorkloadStatusSource 97 // Refers to an undetermined status source. 98 UNKNOWN WorkloadStatusSource 99 // Refers to the override policy that is applied to a set of partial results within a workload. Any static status always overrides any other status values calculated automatically. Otherwise, the worst status of the partial results is rolled up. 100 WORKLOAD WorkloadStatusSource 101 }{ 102 // Refers to the result of an automatic rule defined for a workload. 103 ROLLUP_RULE: "ROLLUP_RULE", 104 // Refers to a static status defined for a workload. 105 STATIC: "STATIC", 106 // Refers to an undetermined status source. 107 UNKNOWN: "UNKNOWN", 108 // Refers to the override policy that is applied to a set of partial results within a workload. Any static status always overrides any other status values calculated automatically. Otherwise, the worst status of the partial results is rolled up. 109 WORKLOAD: "WORKLOAD", 110 } 111 112 // WorkloadStatusValue - The status of the workload, which is derived from the static and the automatic statuses configured. Any static status always overrides any other status values calculated automatically. 113 type WorkloadStatusValue string 114 115 var WorkloadStatusValueTypes = struct { 116 // The status of the workload is degraded. 117 DEGRADED WorkloadStatusValue 118 // The status of the workload is disrupted. 119 DISRUPTED WorkloadStatusValue 120 // The status of the workload is operational. 121 OPERATIONAL WorkloadStatusValue 122 // The status of the workload is unknown. 123 UNKNOWN WorkloadStatusValue 124 }{ 125 // The status of the workload is degraded. 126 DEGRADED: "DEGRADED", 127 // The status of the workload is disrupted. 128 DISRUPTED: "DISRUPTED", 129 // The status of the workload is operational. 130 OPERATIONAL: "OPERATIONAL", 131 // The status of the workload is unknown. 132 UNKNOWN: "UNKNOWN", 133 } 134 135 // WorkloadStatusValueInput - The status value. Any static status always overrides any other status values calculated automatically. 136 type WorkloadStatusValueInput string 137 138 var WorkloadStatusValueInputTypes = struct { 139 // The status of the workload is degraded. 140 DEGRADED WorkloadStatusValueInput 141 // The status of the workload is disrupted. 142 DISRUPTED WorkloadStatusValueInput 143 // The status of the workload is operational. 144 OPERATIONAL WorkloadStatusValueInput 145 }{ 146 // The status of the workload is degraded. 147 DEGRADED: "DEGRADED", 148 // The status of the workload is disrupted. 149 DISRUPTED: "DISRUPTED", 150 // The status of the workload is operational. 151 OPERATIONAL: "OPERATIONAL", 152 } 153 154 // Account - The `Account` object provides general data about the account, as well as 155 // being the entry point into more detailed data about a single account. 156 // 157 // Account configuration data is queried through this object, as well as 158 // telemetry data that is specific to a single account. 159 type Account struct { 160 // 161 ID int `json:"id,omitempty"` 162 // 163 LicenseKey string `json:"licenseKey,omitempty"` 164 // 165 Name string `json:"name,omitempty"` 166 // This field provides access to Workload data. 167 Workload WorkloadAccountStitchedFields `json:"workload,omitempty"` 168 } 169 170 // Actor - The `Actor` object contains fields that are scoped to the API user's access level. 171 type Actor struct { 172 // The `account` field is the entry point into data that is scoped to a single account. 173 Account Account `json:"account,omitempty"` 174 } 175 176 // WorkloadAccountStitchedFields - 177 type WorkloadAccountStitchedFields struct { 178 // [DEPRECATED] Retrieves a workload. 179 Collection WorkloadCollection `json:"collection,omitempty"` 180 // [DEPRECATED] Status and breakdown preview. 181 StatusBreakdownPreview WorkloadWorkloadStatus `json:"statusBreakdownPreview"` 182 } 183 184 // WorkloadAutomaticStatus - The automatic status configuration. 185 type WorkloadAutomaticStatus struct { 186 // Whether the automatic status configuration is enabled or not. 187 Enabled bool `json:"enabled"` 188 // An additional meta-rule that can consider all entities that haven't been evaluated by any other rule. 189 RemainingEntitiesRule WorkloadRemainingEntitiesRule `json:"remainingEntitiesRule,omitempty"` 190 // A list of rules. 191 Rules []WorkloadRegularRule `json:"rules"` 192 } 193 194 // WorkloadAutomaticStatusInput - An input object used to represent an automatic status configuration. If not provided, a status configuration will be created by default. 195 type WorkloadAutomaticStatusInput struct { 196 // Whether the automatic status configuration is enabled or not. 197 Enabled bool `json:"enabled"` 198 // An additional meta-rule that can consider all entities that haven't been evaluated by any other rule. 199 RemainingEntitiesRule *WorkloadRemainingEntitiesRuleInput `json:"remainingEntitiesRule,omitempty"` 200 // A list of rules. 201 Rules []WorkloadRegularRuleInput `json:"rules,omitempty"` 202 } 203 204 // WorkloadCollection - A user defined group of entities. 205 type WorkloadCollection struct { 206 // The account the workload belongs to. 207 Account accounts.AccountReference `json:"account"` 208 // The moment when the object was created, represented in milliseconds since the Unix epoch. 209 CreatedAt *nrtime.EpochMilliseconds `json:"createdAt"` 210 // The user who created the workload. 211 CreatedBy users.UserReference `json:"createdBy,omitempty"` 212 // Relevant information about the workload. 213 Description string `json:"description,omitempty"` 214 // A list of entity GUIDs. These entities will belong to the collection as long as their accounts are included in the scope accounts of the collection. 215 Entities []WorkloadEntityRef `json:"entities"` 216 // A list of entity search queries. The resulting entities will be limited to the scope accounts of the collection. 217 EntitySearchQueries []WorkloadEntitySearchQuery `json:"entitySearchQueries"` 218 // The entity search query that returns the full collection of entities. 219 EntitySearchQuery string `json:"entitySearchQuery,omitempty"` 220 // The unique entity identifier of the workload in New Relic. 221 GUID common.EntityGUID `json:"guid"` 222 // The unique identifier of the workload. 223 ID int `json:"id"` 224 // The workload's name. 225 Name string `json:"name"` 226 // The URL of the workload. 227 Permalink string `json:"permalink"` 228 // Accounts that will be used to get entities from. 229 ScopeAccounts WorkloadScopeAccounts `json:"scopeAccounts"` 230 // Status of the workload. 231 Status WorkloadWorkloadStatus `json:"status"` 232 // The configuration that defines how the status of the workload is calculated. 233 StatusConfig WorkloadStatusConfig `json:"statusConfig,omitempty"` 234 // The moment when the object was last updated, represented in milliseconds since the Unix epoch. 235 UpdatedAt *nrtime.EpochMilliseconds `json:"updatedAt,omitempty"` 236 // The user who last updated the workload. 237 UpdatedBy users.UserReference `json:"updatedBy,omitempty"` 238 } 239 240 // WorkloadCreateInput - The input object used to represent the workload to be created. 241 type WorkloadCreateInput struct { 242 // Relevant information about the workload. 243 Description string `json:"description,omitempty"` 244 // A list of entity GUIDs composing the workload. 245 EntityGUIDs []common.EntityGUID `json:"entityGuids"` 246 // A list of entity search queries used to retrieve the entities that compose the workload. 247 EntitySearchQueries []WorkloadEntitySearchQueryInput `json:"entitySearchQueries,omitempty"` 248 // The name of the workload. 249 Name string `json:"name"` 250 // Accounts that will be used to get entities from. 251 ScopeAccounts *WorkloadScopeAccountsInput `json:"scopeAccounts,omitempty"` 252 // The configuration that defines how the status of the workload is calculated. 253 StatusConfig *WorkloadStatusConfigInput `json:"statusConfig,omitempty"` 254 } 255 256 // WorkloadDuplicateInput - The input object used to represent the workload duplicate. 257 type WorkloadDuplicateInput struct { 258 // The name of the workload duplicate. If the name isn't specified, the name + ' copy' of the source workload is used to compose the new name. 259 Name string `json:"name,omitempty"` 260 } 261 262 // WorkloadEntityRef - A reference to a New Relic entity. 263 type WorkloadEntityRef struct { 264 // The unique entity identifier in New Relic. 265 GUID common.EntityGUID `json:"guid,omitempty"` 266 } 267 268 // WorkloadEntitySearchQuery - An entity search query used to dynamically retrieve a group of entities. 269 type WorkloadEntitySearchQuery struct { 270 // The moment when the object was created, represented in milliseconds since the Unix epoch. 271 CreatedAt *nrtime.EpochMilliseconds `json:"createdAt"` 272 // The user who created the entity search query. 273 CreatedBy users.UserReference `json:"createdBy,omitempty"` 274 // The unique identifier of the entity search query. 275 ID int `json:"id"` 276 // The entity search query that is used to perform the search of a group of entities. 277 Query string `json:"query"` 278 // The moment when the object was last updated, represented in milliseconds since the Unix epoch. 279 UpdatedAt *nrtime.EpochMilliseconds `json:"updatedAt,omitempty"` 280 } 281 282 // WorkloadEntitySearchQueryInput - The input object used to represent the entity search query to be created. 283 type WorkloadEntitySearchQueryInput struct { 284 // The entity search query that is used to perform the search of a group of entities. 285 Query string `json:"query"` 286 } 287 288 // WorkloadRegularRule - The definition of a rule, which consists of a group of entities and a rollup strategy. 289 type WorkloadRegularRule struct { 290 // A list of entity GUIDs. These entities will belong to the collection as long as their accounts are included in the scope accounts of the collection. 291 Entities []WorkloadEntityRef `json:"entities"` 292 // A list of entity search queries. These queries are constrained to the workload contents. 293 EntitySearchQueries []WorkloadEntitySearchQuery `json:"entitySearchQueries"` 294 // The unique identifier of the rule. 295 ID int `json:"id,omitempty"` 296 // The rollup strategy. 297 Rollup WorkloadRollup `json:"rollup"` 298 } 299 300 // WorkloadRegularRuleInput - The input object used to represent a rule. 301 type WorkloadRegularRuleInput struct { 302 // A list of entity GUIDs composing the rule. 303 EntityGUIDs []common.EntityGUID `json:"entityGuids"` 304 // A list of entity search queries used to retrieve the entities that compose the rule. 305 EntitySearchQueries []WorkloadEntitySearchQueryInput `json:"entitySearchQueries,omitempty"` 306 // The input object used to represent a rollup strategy. 307 Rollup *WorkloadRollupInput `json:"rollup,omitempty"` 308 } 309 310 // WorkloadRemainingEntitiesRule - The definition of a remaining entities rule. 311 type WorkloadRemainingEntitiesRule struct { 312 // The rollup strategy. 313 Rollup WorkloadRemainingEntitiesRuleRollup `json:"rollup"` 314 } 315 316 // WorkloadRemainingEntitiesRuleInput - The input object used to represent a remaining entities rule. 317 type WorkloadRemainingEntitiesRuleInput struct { 318 // The input object used to represent a rollup strategy. 319 Rollup *WorkloadRemainingEntitiesRuleRollupInput `json:"rollup,omitempty"` 320 } 321 322 // WorkloadRemainingEntitiesRuleRollup - The rollup strategy. 323 type WorkloadRemainingEntitiesRuleRollup struct { 324 // The grouping to be applied to the remaining entities. 325 GroupBy WorkloadGroupRemainingEntitiesRuleBy `json:"groupBy"` 326 // The rollup strategy that is applied to a group of entities. 327 Strategy WorkloadRollupStrategy `json:"strategy"` 328 // Type of threshold defined for the rule. This is an optional field that only applies when strategy is WORST_STATUS_WINS. Use a threshold to roll up the worst status only after a certain amount of entities are not operational. 329 ThresholdType WorkloadRuleThresholdType `json:"thresholdType,omitempty"` 330 // Threshold value defined for the rule. This optional field is used in combination with thresholdType. If the threshold type is null, the threshold value will be ignored. 331 ThresholdValue int `json:"thresholdValue,omitempty"` 332 } 333 334 // WorkloadRemainingEntitiesRuleRollupInput - The input object used to represent a rollup strategy. 335 type WorkloadRemainingEntitiesRuleRollupInput struct { 336 // The grouping to be applied to the remaining entities. 337 GroupBy WorkloadGroupRemainingEntitiesRuleBy `json:"groupBy"` 338 // The rollup strategy that is applied to a group of entities. 339 Strategy WorkloadRollupStrategy `json:"strategy"` 340 // Type of threshold defined for the rule. This is an optional field that only applies when strategy is WORST_STATUS_WINS. Use a threshold to roll up the worst status only after a certain amount of entities are not operational. 341 ThresholdType WorkloadRuleThresholdType `json:"thresholdType,omitempty"` 342 // Threshold value defined for the rule. This optional field is used in combination with thresholdType. If the threshold type is null, the threshold value will be ignored. 343 ThresholdValue int `json:"thresholdValue,omitempty"` 344 } 345 346 // WorkloadRollup - The rollup strategy. 347 type WorkloadRollup struct { 348 // The rollup strategy that is applied to the group of entities. 349 Strategy WorkloadRollupStrategy `json:"strategy"` 350 // Type of threshold defined for the rule. This is an optional field that only applies when strategy is WORST_STATUS_WINS. Use a threshold to roll up the worst status only after a certain amount of entities are not operational. 351 ThresholdType WorkloadRuleThresholdType `json:"thresholdType,omitempty"` 352 // Threshold value defined for the rule. This optional field is used in combination with thresholdType. If the threshold type is null, the threshold value will be ignored. 353 ThresholdValue int `json:"thresholdValue,omitempty"` 354 } 355 356 // WorkloadRollupInput - The input object used to represent a rollup strategy. 357 type WorkloadRollupInput struct { 358 // The rollup strategy that is applied to a group of entities. 359 Strategy WorkloadRollupStrategy `json:"strategy"` 360 // Type of threshold defined for the rule. This is an optional field that only applies when strategy is WORST_STATUS_WINS. Use a threshold to roll up the worst status only after a certain amount of entities are not operational. 361 ThresholdType WorkloadRuleThresholdType `json:"thresholdType,omitempty"` 362 // Threshold value defined for the rule. This optional field is used in combination with thresholdType. If the threshold type is null, the threshold value will be ignored. 363 ThresholdValue int `json:"thresholdValue,omitempty"` 364 } 365 366 // WorkloadRollupRuleDetails - Represents the details of a rollup rule. 367 type WorkloadRollupRuleDetails struct { 368 // A list of entity search queries defined in the rule. 369 EntitySearchQueries []string `json:"entitySearchQueries"` 370 // Indicates if the rule has individual entities. 371 HasIndividualEntities bool `json:"hasIndividualEntities"` 372 // The amount of not operational entities after evaluating the rule. 373 NotOperationalEntities int `json:"notOperationalEntities"` 374 // The amount of operational entities after evaluating the rule. 375 OperationalEntities int `json:"operationalEntities"` 376 // The resulting type of the rollup rule. 377 ResultingGroupType WorkloadResultingGroupType `json:"resultingGroupType"` 378 // Type of threshold defined for the rule. 379 ThresholdType WorkloadRuleThresholdType `json:"thresholdType,omitempty"` 380 // The amount of entities the status of which is unknown. 381 UnknownStatusEntities int `json:"unknownStatusEntities"` 382 } 383 384 // WorkloadRollupRuleStatusResult - A rollup rule that was involved in the calculation of the workload status. 385 type WorkloadRollupRuleStatusResult struct { 386 // Represents the details of a rollup rule. 387 RollupRuleDetails WorkloadRollupRuleDetails `json:"rollupRuleDetails,omitempty"` 388 // Indicates where the status value derives from. 389 Source WorkloadStatusSource `json:"source"` 390 // The status of a rollup rule. 391 Value WorkloadStatusValue `json:"value"` 392 } 393 394 func (x *WorkloadRollupRuleStatusResult) ImplementsWorkloadStatusResult() {} 395 396 // WorkloadScopeAccounts - Accounts that will be used to get entities from. 397 type WorkloadScopeAccounts struct { 398 // A list of accounts that will be used to get entities from. 399 AccountIDs []int `json:"accountIds"` 400 } 401 402 // WorkloadScopeAccountsInput - The input object containing accounts that will be used to get entities from. 403 type WorkloadScopeAccountsInput struct { 404 // A list of accounts that will be used to get entities from. 405 AccountIDs []int `json:"accountIds"` 406 } 407 408 // WorkloadStaticStatus - The static status configuration. 409 type WorkloadStaticStatus struct { 410 // A description that provides additional details about the status of the workload. 411 Description string `json:"description,omitempty"` 412 // Whether the static status configuration is enabled or not. Note that only one static status can be enabled at a given time. 413 Enabled bool `json:"enabled"` 414 // The unique identifier of the static status. 415 ID int `json:"id"` 416 // The status of the workload. 417 Status WorkloadStatusValue `json:"status"` 418 // A short description of the status of the workload. 419 Summary string `json:"summary,omitempty"` 420 } 421 422 // WorkloadStaticStatusInput - The input object used to represent the configuration of a static status. 423 type WorkloadStaticStatusInput struct { 424 // A description that provides additional details about the status of the workload. 425 Description string `json:"description,omitempty"` 426 // Whether the static status configuration is enabled or not. 427 Enabled bool `json:"enabled"` 428 // The status of the workload. 429 Status WorkloadStatusValueInput `json:"status"` 430 // A short description of the status of the workload. 431 Summary string `json:"summary,omitempty"` 432 } 433 434 // WorkloadStaticStatusResult - A static status that was involved in the calculation of the workload status. 435 type WorkloadStaticStatusResult struct { 436 // A description that provides additional details about the status of the workload. 437 Description string `json:"description,omitempty"` 438 // Indicates where the status value derives from. 439 Source WorkloadStatusSource `json:"source"` 440 // A short description of the status of the workload. 441 Summary string `json:"summary,omitempty"` 442 // The value of a static status. 443 Value WorkloadStatusValue `json:"value"` 444 } 445 446 func (x *WorkloadStaticStatusResult) ImplementsWorkloadStatusResult() {} 447 448 // WorkloadStatus - Detailed information about the status of a workload. 449 type WorkloadStatus struct { 450 // A description that provides additional details about the status of the workload. 451 Description string `json:"description,omitempty"` 452 // Indicates where the status value derives from. 453 StatusSource WorkloadStatusSource `json:"statusSource,omitempty"` 454 // The status of the workload. 455 StatusValue WorkloadStatusValue `json:"statusValue,omitempty"` 456 // A short description of the status of the workload. 457 Summary string `json:"summary,omitempty"` 458 } 459 460 // WorkloadStatusConfig - The configuration that defines how the status of the workload is calculated. 461 type WorkloadStatusConfig struct { 462 // An automatic status configuration. 463 Automatic WorkloadAutomaticStatus `json:"automatic,omitempty"` 464 // A list of static status configurations. 465 Static []WorkloadStaticStatus `json:"static"` 466 } 467 468 // WorkloadStatusConfigInput - The input object used to provide the configuration that defines how the status of the workload is calculated. 469 type WorkloadStatusConfigInput struct { 470 // An input object used to represent an automatic status configuration. 471 Automatic *WorkloadAutomaticStatusInput `json:"automatic,omitempty"` 472 // A list of static status configurations. You can only configure one static status for a workload. 473 Static []WorkloadStaticStatusInput `json:"static,omitempty"` 474 } 475 476 // WorkloadStatusResult - The details of a status that was involved in the calculation of the workload status. 477 type WorkloadStatusResult struct { 478 // Indicates where the status value derives from. 479 Source WorkloadStatusSource `json:"source"` 480 // The value of a status. 481 Value WorkloadStatusValue `json:"value"` 482 } 483 484 func (x *WorkloadStatusResult) ImplementsWorkloadStatusResult() {} 485 486 // WorkloadUpdateAutomaticStatusInput - An input object used to represent an automatic status configuration. 487 type WorkloadUpdateAutomaticStatusInput struct { 488 // Whether the automatic status configuration is enabled or not. 489 Enabled bool `json:"enabled"` 490 // An additional meta-rule that can consider all entities that haven't been evaluated by any other rule. 491 RemainingEntitiesRule *WorkloadRemainingEntitiesRuleInput `json:"remainingEntitiesRule,omitempty"` 492 // A list of rules. 493 Rules []WorkloadUpdateRegularRuleInput `json:"rules,omitempty"` 494 } 495 496 // WorkloadUpdateCollectionEntitySearchQueryInput - The input object used to represent the entity search query to be updated. 497 type WorkloadUpdateCollectionEntitySearchQueryInput struct { 498 // The unique identifier of the entity search query to be updated. If not provided, a new entity search query is created. 499 ID int `json:"id,omitempty"` 500 // The entity search query that is used to perform the search of a group of entities. 501 Query string `json:"query"` 502 } 503 504 // WorkloadUpdateInput - The input object used to identify the workload to be updated and the new values. 505 type WorkloadUpdateInput struct { 506 // Relevant information about the workload. 507 Description string `json:"description,omitempty"` 508 // A list of entity GUIDs composing the workload. 509 EntityGUIDs []common.EntityGUID `json:"entityGuids"` 510 // A list of entity search queries used to retrieve the groups of entities that compose the workload. 511 EntitySearchQueries []WorkloadUpdateCollectionEntitySearchQueryInput `json:"entitySearchQueries,omitempty"` 512 // The name of the workload. 513 Name string `json:"name,omitempty"` 514 // Accounts that will be used to get entities from. 515 ScopeAccounts *WorkloadScopeAccountsInput `json:"scopeAccounts,omitempty"` 516 // The configuration that defines how the status of the workload is calculated. 517 StatusConfig *WorkloadUpdateStatusConfigInput `json:"statusConfig,omitempty"` 518 } 519 520 // WorkloadUpdateRegularRuleInput - The input object used to represent a rule. 521 type WorkloadUpdateRegularRuleInput struct { 522 // A list of entity GUIDs composing the rule. 523 EntityGUIDs []common.EntityGUID `json:"entityGuids"` 524 // A list of entity search queries used to retrieve the groups of entities that compose the rule. 525 EntitySearchQueries []WorkloadUpdateCollectionEntitySearchQueryInput `json:"entitySearchQueries,omitempty"` 526 // The unique identifier of the rule to be updated. If not provided, a new rule is created. 527 ID int `json:"id,omitempty"` 528 // The input object used to represent a roll-up strategy. 529 Rollup *WorkloadRollupInput `json:"rollup,omitempty"` 530 } 531 532 // WorkloadUpdateStaticStatusInput - The input object used to represent the configuration of a static status. 533 type WorkloadUpdateStaticStatusInput struct { 534 // A description that provides additional details about the status of the workload. 535 Description string `json:"description,omitempty"` 536 // Whether the static status configuration is enabled or not. 537 Enabled bool `json:"enabled"` 538 // The unique identifier of the static status to be updated. If not provided, a new static status is created. 539 ID int `json:"id,omitempty"` 540 // The status of the workload. 541 Status WorkloadStatusValueInput `json:"status"` 542 // A short description of the static status. 543 Summary string `json:"summary,omitempty"` 544 } 545 546 // WorkloadUpdateStatusConfigInput - The input object used to provide the configuration that defines how the status of the workload is calculated. 547 type WorkloadUpdateStatusConfigInput struct { 548 // An input object used to represent an automatic status configuration. 549 Automatic *WorkloadUpdateAutomaticStatusInput `json:"automatic,omitempty"` 550 // A list of static status configurations. You can only configure one static status for a workload. 551 Static []WorkloadUpdateStaticStatusInput `json:"static,omitempty"` 552 } 553 554 // WorkloadWorkloadStatus - Status of the workload. 555 type WorkloadWorkloadStatus struct { 556 // A description that provides additional details about the status of the workload. 557 Description string `json:"description,omitempty"` 558 // Indicates where the status value derives from. 559 Source WorkloadStatusSource `json:"source"` 560 // The details of the statuses that were involved in the calculation of the workload status. 561 StatusDetails []WorkloadStatusResultInterface `json:"statusDetails"` 562 // A short description of the status of the workload. 563 Summary string `json:"summary,omitempty"` 564 // The status of the workload. 565 Value WorkloadStatusValue `json:"value"` 566 } 567 568 // special 569 func (x *WorkloadWorkloadStatus) UnmarshalJSON(b []byte) error { 570 var objMap map[string]*json.RawMessage 571 err := json.Unmarshal(b, &objMap) 572 if err != nil { 573 return err 574 } 575 576 for k, v := range objMap { 577 if v == nil { 578 continue 579 } 580 581 switch k { 582 case "description": 583 err = json.Unmarshal(*v, &x.Description) 584 if err != nil { 585 return err 586 } 587 case "source": 588 err = json.Unmarshal(*v, &x.Source) 589 if err != nil { 590 return err 591 } 592 case "statusDetails": 593 if v == nil { 594 continue 595 } 596 var rawMessageStatusDetails []*json.RawMessage 597 err = json.Unmarshal(*v, &rawMessageStatusDetails) 598 if err != nil { 599 return err 600 } 601 602 for _, m := range rawMessageStatusDetails { 603 xxx, err := UnmarshalWorkloadStatusResultInterface(*m) 604 if err != nil { 605 return err 606 } 607 608 if xxx != nil { 609 x.StatusDetails = append(x.StatusDetails, *xxx) 610 } 611 } 612 case "summary": 613 err = json.Unmarshal(*v, &x.Summary) 614 if err != nil { 615 return err 616 } 617 case "value": 618 err = json.Unmarshal(*v, &x.Value) 619 if err != nil { 620 return err 621 } 622 } 623 } 624 625 return nil 626 } 627 628 type collectionResponse struct { 629 Actor Actor `json:"actor"` 630 } 631 632 // AttributeMap - This scalar represents a map of attributes in the form of key-value pairs. 633 type AttributeMap string 634 635 // DateTime - The `DateTime` scalar represents a date and time. The `DateTime` appears as an ISO8601 formatted string. 636 type DateTime string 637 638 // Float - The `Float` scalar type represents signed double-precision fractional 639 // values as specified by 640 // [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). 641 type Float string 642 643 // ID - The `ID` scalar type represents a unique identifier, often used to 644 // refetch an object or as key for a cache. The ID type appears in a JSON 645 // response as a String; however, it is not intended to be human-readable. 646 // When expected as an input type, any string (such as `"4"`) or integer 647 // (such as `4`) input value will be accepted as an ID. 648 type ID string 649 650 // Minutes - The `Minutes` scalar represents a duration in minutes 651 type Minutes string 652 653 // NRQL - This scalar represents a NRQL query string. 654 // 655 // See the [NRQL Docs](https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-resources/nrql-syntax-components-functions) for more information about NRQL syntax. 656 type NRQL string 657 658 // NerdStorageDocument - This scalar represents a NerdStorage document. 659 type NerdStorageDocument string 660 661 // Seconds - The `Seconds` scalar represents a duration in seconds 662 type Seconds string 663 664 // WorkloadStatusResult - The details of a status that was involved in the calculation of the workload status. 665 type WorkloadStatusResultInterface interface { 666 ImplementsWorkloadStatusResult() 667 } 668 669 // UnmarshalWorkloadStatusResultInterface unmarshals the interface into the correct type 670 // based on __typename provided by GraphQL 671 func UnmarshalWorkloadStatusResultInterface(b []byte) (*WorkloadStatusResultInterface, error) { 672 var err error 673 674 var rawMessageWorkloadStatusResult map[string]*json.RawMessage 675 err = json.Unmarshal(b, &rawMessageWorkloadStatusResult) 676 if err != nil { 677 return nil, err 678 } 679 680 // Nothing to unmarshal 681 if len(rawMessageWorkloadStatusResult) < 1 { 682 return nil, nil 683 } 684 685 var typeName string 686 687 if rawTypeName, ok := rawMessageWorkloadStatusResult["__typename"]; ok { 688 err = json.Unmarshal(*rawTypeName, &typeName) 689 if err != nil { 690 return nil, err 691 } 692 693 switch typeName { 694 case "WorkloadRollupRuleStatusResult": 695 var interfaceType WorkloadRollupRuleStatusResult 696 err = json.Unmarshal(b, &interfaceType) 697 if err != nil { 698 return nil, err 699 } 700 701 var xxx WorkloadStatusResultInterface = &interfaceType 702 703 return &xxx, nil 704 case "WorkloadStaticStatusResult": 705 var interfaceType WorkloadStaticStatusResult 706 err = json.Unmarshal(b, &interfaceType) 707 if err != nil { 708 return nil, err 709 } 710 711 var xxx WorkloadStatusResultInterface = &interfaceType 712 713 return &xxx, nil 714 } 715 } else { 716 keys := []string{} 717 for k := range rawMessageWorkloadStatusResult { 718 keys = append(keys, k) 719 } 720 return nil, fmt.Errorf("interface WorkloadStatusResult did not include a __typename field for inspection: %s", keys) 721 } 722 723 return nil, fmt.Errorf("interface WorkloadStatusResult was not matched against all PossibleTypes: %s", typeName) 724 }